From: Douglas Bagnall Date: Wed, 8 Jun 2022 07:53:57 +0000 (+1200) Subject: pytest/samba_tool_drs: use TestCaseInTempDir.rm_files/.rm_dirs X-Git-Tag: talloc-2.4.0~1200 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f0aab45c81c9f9b6b87eb68bc785902619dc10d;p=thirdparty%2Fsamba.git pytest/samba_tool_drs: use TestCaseInTempDir.rm_files/.rm_dirs Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett Reviewed-by: Noel Power --- diff --git a/source4/torture/drs/python/samba_tool_drs.py b/source4/torture/drs/python/samba_tool_drs.py index ac97162e23d..8538c3041a4 100644 --- a/source4/torture/drs/python/samba_tool_drs.py +++ b/source4/torture/drs/python/samba_tool_drs.py @@ -19,7 +19,6 @@ """Blackbox tests for samba-tool drs.""" import samba.tests -import shutil import os import ldb import drs_base @@ -42,15 +41,9 @@ class SambaToolDrsTests(drs_base.DrsBaseTestCase): self._enable_inbound_repl(self.dnsname_dc1) self._enable_inbound_repl(self.dnsname_dc2) - try: - shutil.rmtree(os.path.join(self.tempdir, "private")) - shutil.rmtree(os.path.join(self.tempdir, "etc")) - shutil.rmtree(os.path.join(self.tempdir, "msg.lock")) - os.remove(os.path.join(self.tempdir, "names.tdb")) - shutil.rmtree(os.path.join(self.tempdir, "state")) - shutil.rmtree(os.path.join(self.tempdir, "bind-dns")) - except Exception: - pass + self.rm_files('names.tdb', allow_missing=True) + self.rm_dirs('etc', 'msg.lock', 'private', 'state', 'bind-dns', + allow_missing=True) super(SambaToolDrsTests, self).tearDown()