From 0f1c493aa032b60210fc63c6b120b833ba4c10de Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Thu, 21 Jun 2012 15:57:09 -0700 Subject: Use the mocker built-in method for creating temporary dirs (which it will cleanup) --- tests/unittests/test_util.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'tests/unittests') diff --git a/tests/unittests/test_util.py b/tests/unittests/test_util.py index 27c0fbd6..aea1aabb 100644 --- a/tests/unittests/test_util.py +++ b/tests/unittests/test_util.py @@ -1,6 +1,3 @@ -from shutil import rmtree -from tempfile import mkdtemp - import os import stat @@ -10,7 +7,7 @@ from mocker import MockerTestCase from cloudinit import util -class TestMergeDict(TestCase): +class TestMergeDict(MockerTestCase): def test_simple_merge(self): """Test simple non-conflict merge.""" source = {"key1": "value1"} @@ -105,12 +102,10 @@ class TestWriteFile(MockerTestCase): def setUp(self): super(TestWriteFile, self).setUp() # Make a temp directoy for tests to use. - self.tmp = mkdtemp(prefix="unittest_") + self.tmp = self.makeDir(prefix="unittest_") def tearDown(self): super(TestWriteFile, self).tearDown() - # Clean up temp directory - rmtree(self.tmp) def test_basic_usage(self): """Verify basic usage with default args.""" -- cgit v1.2.3