diff options
Diffstat (limited to 'tests/unittests/test__init__.py')
-rw-r--r-- | tests/unittests/test__init__.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/unittests/test__init__.py b/tests/unittests/test__init__.py index ce4704d8..f5dc3435 100644 --- a/tests/unittests/test__init__.py +++ b/tests/unittests/test__init__.py @@ -57,14 +57,11 @@ class TestWalkerHandleHandler(unittest.TestCase): # Mock the write_file() function. We'll assert that it got called as # expected in each of the individual tests. - self.resources = ExitStack() - self.write_file_mock = self.resources.enter_context( + resources = ExitStack() + self.addCleanup(resources.close) + self.write_file_mock = resources.enter_context( mock.patch('cloudinit.util.write_file')) - def tearDown(self): - self.resources.close() - unittest.TestCase.tearDown(self) - def test_no_errors(self): """Payload gets written to file and added to C{pdata}.""" with mock.patch('cloudinit.importer.import_module', |