Fixed test_config.ini file path error
This commit is contained in:
parent
aa955acf04
commit
14f1c15945
|
@ -180,6 +180,7 @@ class BMConfigParser(SafeConfigParser):
|
||||||
self.remove_section(x)
|
self.remove_section(x)
|
||||||
|
|
||||||
def read(self, filenames):
|
def read(self, filenames):
|
||||||
|
self._reset()
|
||||||
SafeConfigParser.read(self, filenames)
|
SafeConfigParser.read(self, filenames)
|
||||||
for section in self.sections():
|
for section in self.sections():
|
||||||
for option in self.options(section):
|
for option in self.options(section):
|
||||||
|
|
|
@ -7,7 +7,7 @@ import tempfile
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# from six.moves import configparser
|
from pybitmessage import paths
|
||||||
from pybitmessage.bmconfigparser import BMConfigParser
|
from pybitmessage.bmconfigparser import BMConfigParser
|
||||||
|
|
||||||
test_config = {
|
test_config = {
|
||||||
|
@ -91,13 +91,17 @@ class TestConfig(unittest.TestCase):
|
||||||
|
|
||||||
def test_reset(self):
|
def test_reset(self):
|
||||||
"""safeGetInt retuns provided default for bitmessagesettings option or 0"""
|
"""safeGetInt retuns provided default for bitmessagesettings option or 0"""
|
||||||
if sys.version_info[0] >= 3:
|
|
||||||
BMConfigParser().read_dict(test_config)
|
BMConfigParser().read(
|
||||||
else:
|
os.path.join(
|
||||||
BMConfigParser().read('src/tests/test_config.ini')
|
os.path.abspath(os.path.dirname(__file__)),
|
||||||
|
'test_pattern', 'test_config.ini'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
BMConfigParser().safeGetInt('bitmessagesettings', 'maxaddrperstreamsend'), 100)
|
BMConfigParser().safeGetInt('bitmessagesettings', 'maxaddrperstreamsend'), 100)
|
||||||
# pylint: disable=protected-access
|
|
||||||
BMConfigParser()._reset()
|
BMConfigParser()._reset()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
BMConfigParser().safeGetInt('bitmessagesettings', 'maxaddrperstreamsend'), 500)
|
BMConfigParser().safeGetInt('bitmessagesettings', 'maxaddrperstreamsend'), 500)
|
||||||
|
|
0
src/tests/test_pattern/test_config.ini
Normal file → Executable file
0
src/tests/test_pattern/test_config.ini
Normal file → Executable file
Reference in New Issue
Block a user