From: Andrew Bartlett Date: Fri, 31 May 2019 00:47:13 +0000 (+1200) Subject: Revert TestCaseInSubDir parts of "downgradedatabase: blackbox test" X-Git-Tag: ldb-2.0.5~421 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=56400153c8c7052fe319f273c30c6d59556102dc;p=thirdparty%2Fsamba.git Revert TestCaseInSubDir parts of "downgradedatabase: blackbox test" This reverts part of commit 74d15c9bf76f0a2fb5fa7b7b1d80971d10c4fe45. TestCaseInSubDir should not have been modified in this way, instead the downgradedatabase test should have removed the files it created specifically (this is part of the test, it shows the right files were created). BUG: https://bugzilla.samba.org/show_bug.cgi?id=13978 Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Fri Jun 7 21:08:12 UTC 2019 on sn-devel-184 --- diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 03c21c2bc88..cbd164de1f9 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -19,7 +19,6 @@ """Samba Python tests.""" from __future__ import print_function import os -import shutil import tempfile import warnings import ldb @@ -295,15 +294,11 @@ class TestCaseInTempDir(TestCase): super(TestCaseInTempDir, self).setUp() self.tempdir = tempfile.mkdtemp() self.addCleanup(self._remove_tempdir) - self.check_tempdir_empty = True def _remove_tempdir(self): # Note asserting here is treated as an error rather than a test failure - if self.check_tempdir_empty: - self.assertEquals([], os.listdir(self.tempdir)) - os.rmdir(self.tempdir) - else: - shutil.rmtree(self.tempdir) + self.assertEquals([], os.listdir(self.tempdir)) + os.rmdir(self.tempdir) self.tempdir = None @contextmanager