From cb74876aa4c9e81eab4f1f0fa4967988f708db15 Mon Sep 17 00:00:00 2001 From: Scott Moser <smoser@ubuntu.com> Date: Fri, 10 Jun 2016 14:49:34 -0400 Subject: fix one large source of leaked tmpfiles --- tests/unittests/test_datasource/test_smartos.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unittests/test_datasource/test_smartos.py b/tests/unittests/test_datasource/test_smartos.py index c809117b..ec57cff1 100644 --- a/tests/unittests/test_datasource/test_smartos.py +++ b/tests/unittests/test_datasource/test_smartos.py @@ -146,7 +146,9 @@ class TestSmartOSDataSource(FilesystemMockingTestCase): self.addCleanup(shutil.rmtree, self.tmp) self.paths = c_helpers.Paths({'cloud_dir': self.tmp}) - self.legacy_user_d = tempfile.mkdtemp() + self.legacy_user_d = os.path.join(self.tmp, 'legacy_user_tmp') + os.mkdir(self.legacy_user_d) + self.orig_lud = DataSourceSmartOS.LEGACY_USER_D DataSourceSmartOS.LEGACY_USER_D = self.legacy_user_d -- cgit v1.2.3 From 2d3eb3a5730208b84e141f08df10f23c1447fdb5 Mon Sep 17 00:00:00 2001 From: Scott Moser <smoser@ubuntu.com> Date: Fri, 10 Jun 2016 15:00:52 -0400 Subject: one more --- tests/unittests/test_datasource/test_azure_helper.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/unittests/test_datasource/test_azure_helper.py b/tests/unittests/test_datasource/test_azure_helper.py index d07a1f07..9a15d15e 100644 --- a/tests/unittests/test_datasource/test_azure_helper.py +++ b/tests/unittests/test_datasource/test_azure_helper.py @@ -1,4 +1,5 @@ import os +import shutil from cloudinit.sources.helpers import azure as azure_helper @@ -288,6 +289,7 @@ class TestOpenSSLManager(TestCase): self.subp.side_effect = capture_directory manager = azure_helper.OpenSSLManager() self.assertEqual(manager.tmpdir, subp_directory['path']) + manager.clean_up() @mock.patch.object(azure_helper, 'cd', mock.MagicMock()) @mock.patch.object(azure_helper.tempfile, 'mkdtemp', mock.MagicMock()) -- cgit v1.2.3 From 785fe5632d58633dea5d6b2c1c5ecbaca35471a3 Mon Sep 17 00:00:00 2001 From: Scott Moser <smoser@ubuntu.com> Date: Fri, 10 Jun 2016 15:03:24 -0400 Subject: remove unused import --- tests/unittests/test_datasource/test_azure_helper.py | 1 - 1 file changed, 1 deletion(-) (limited to 'tests') diff --git a/tests/unittests/test_datasource/test_azure_helper.py b/tests/unittests/test_datasource/test_azure_helper.py index 9a15d15e..70e8f7f2 100644 --- a/tests/unittests/test_datasource/test_azure_helper.py +++ b/tests/unittests/test_datasource/test_azure_helper.py @@ -1,5 +1,4 @@ import os -import shutil from cloudinit.sources.helpers import azure as azure_helper -- cgit v1.2.3