Allow TestProcess subclasses set home dir, use mkdtemp for test_config
This commit is contained in:
parent
affdb2fdc0
commit
cf4e812334
|
@ -4,6 +4,7 @@ Various tests for config
|
|||
|
||||
import os
|
||||
import unittest
|
||||
import tempfile
|
||||
|
||||
from pybitmessage.bmconfigparser import BMConfigParser
|
||||
from test_process import TestProcessProto
|
||||
|
@ -41,6 +42,7 @@ class TestConfig(unittest.TestCase):
|
|||
|
||||
class TestProcessConfig(TestProcessProto):
|
||||
"""A test case for keys.dat"""
|
||||
home = tempfile.mkdtemp()
|
||||
|
||||
def test_config_defaults(self):
|
||||
"""Test settings in the generated config"""
|
||||
|
|
|
@ -28,12 +28,16 @@ class TestProcessProto(unittest.TestCase):
|
|||
'keys.dat', 'debug.log', 'messages.dat', 'knownnodes.dat',
|
||||
'.api_started', 'unittest.lock'
|
||||
)
|
||||
home = None
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Setup environment and start pybitmessage"""
|
||||
cls.flag = False
|
||||
cls.home = os.environ['BITMESSAGE_HOME'] = tempfile.gettempdir()
|
||||
if not cls.home:
|
||||
cls.home = tempfile.gettempdir()
|
||||
cls._cleanup_files()
|
||||
os.environ['BITMESSAGE_HOME'] = cls.home
|
||||
put_signal_file(cls.home, 'unittest.lock')
|
||||
subprocess.Popen(
|
||||
cls._process_cmd,
|
||||
|
|
Loading…
Reference in New Issue
Block a user