diff --git a/tests/__init__.py b/tests/__init__.py index 07eb564..f254765 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -133,18 +133,14 @@ class TestBase(unittest.TestCase): super(TestBase, self).setUp() self.data = TestData() self.britney = os.path.join(PROJECT_DIR, 'britney.py') - self.britney_conf = os.path.join(PROJECT_DIR, 'britney.conf') + # create temporary config so that tests can hack it + self.britney_conf = os.path.join(self.data.path, 'britney.conf') + shutil.copy(os.path.join(PROJECT_DIR, 'britney.conf'), self.britney_conf) assert os.path.exists(self.britney) - assert os.path.exists(self.britney_conf) def tearDown(self): del self.data - def restore_config(self, content): - """Helper for restoring configuration contents on cleanup.""" - with open(self.britney_conf, 'w') as fp: - fp.write(content) - def run_britney(self, args=[]): '''Run britney. diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 6112098..a9106ee 100644 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -39,7 +39,6 @@ class TestAutoPkgTest(TestBase): 'BOOTTEST_ENABLE = yes', 'BOOTTEST_ENABLE = no') with open(self.britney_conf, 'w') as fp: fp.write(new_config) - self.addCleanup(self.restore_config, original_config) # fake adt-britney script self.adt_britney = os.path.join( diff --git a/tests/test_boottest.py b/tests/test_boottest.py index 9e4014a..770f501 100644 --- a/tests/test_boottest.py +++ b/tests/test_boottest.py @@ -143,7 +143,6 @@ class TestBoottestEnd2End(TestBase): 'BOOTTEST_FETCH = yes', 'BOOTTEST_FETCH = no') with open(self.britney_conf, 'w') as fp: fp.write(new_config) - self.addCleanup(self.restore_config, original_config) self.data.add('libc6', False, {'Architecture': 'armhf'}),