summaryrefslogtreecommitdiff
path: root/tests/unittests/test__init__.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2015-01-22 14:46:21 -0500
committerBarry Warsaw <barry@python.org>2015-01-22 14:46:21 -0500
commit9a16a6a2e9929098474e0db23db130cf172aeba4 (patch)
tree8807a5958b5f8ebe29643787cf29ef5f99d2700e /tests/unittests/test__init__.py
parent6363b546c8bacb24b9350d108165a09bb65828a1 (diff)
downloadvyos-cloud-init-9a16a6a2e9929098474e0db23db130cf172aeba4.tar.gz
vyos-cloud-init-9a16a6a2e9929098474e0db23db130cf172aeba4.zip
Use .addCleanup() instead of a .tearDown() where appropriate, although we
might have to rewrite this for Python 2.6. Disable Cepko tests (test_cs_util.py) since they are essentially worthless. Convert test_azure to unittest.mock.
Diffstat (limited to 'tests/unittests/test__init__.py')
-rw-r--r--tests/unittests/test__init__.py9
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',