From 8d397b69bb29b7a464b610bc46cedd6be01b2455 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 Oct 2012 15:58:06 -0800 Subject: TestCaseInTempDir: Use addCleanup rather than tearDown. --- source4/scripting/python/samba/tests/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4') diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index b13bcabbac..2df30a641b 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -76,11 +76,12 @@ class TestCaseInTempDir(TestCase): def setUp(self): super(TestCaseInTempDir, self).setUp() self.tempdir = tempfile.mkdtemp() + self.addCleanup(self._remove_tempdir) - def tearDown(self): - super(TestCaseInTempDir, self).tearDown() + def _remove_tempdir(self): self.assertEquals([], os.listdir(self.tempdir)) os.rmdir(self.tempdir) + self.tempdir = None def env_loadparm(): -- cgit