Revert TestCaseInSubDir parts of "downgradedatabase: blackbox test"
authorAndrew Bartlett <abartlet@samba.org>
Fri, 31 May 2019 00:47:13 +0000 (12:47 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 7 Jun 2019 21:08:12 +0000 (21:08 +0000)
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 <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jun  7 21:08:12 UTC 2019 on sn-devel-184

python/samba/tests/__init__.py

index 03c21c2bc889759a5b7f8fd57a06a1bfbb2dfac2..cbd164de1f9d19bd637e5fcf6ba327e9cbf18b9c 100644 (file)
@@ -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