From: Noel Power Date: Mon, 27 Jul 2020 15:51:12 +0000 (+0100) Subject: python/samba/tests/blackbox: Preparatory change to support custom share X-Git-Tag: talloc-2.3.2~672 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c681f5bfe3669f913a6e592844458e1fd6a9fa13;p=thirdparty%2Fsamba.git python/samba/tests/blackbox: Preparatory change to support custom share tearDown method doesn't handle local file deletion fallback if a share other than 'tmp' is used Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/python/samba/tests/blackbox/smbcacls.py b/python/samba/tests/blackbox/smbcacls.py index b711530de02..3eca9602005 100644 --- a/python/samba/tests/blackbox/smbcacls.py +++ b/python/samba/tests/blackbox/smbcacls.py @@ -37,6 +37,7 @@ class SmbCaclsBlockboxTestBase(BlackboxTestCase): self.creds.set_password(self.passwd) self.testdir = os.getenv("TESTDIR", "smbcacls") self.share = os.getenv("SHARE", "tmp") + self.dirpath = os.path.join(os.environ["LOCAL_PATH"],self.testdir) def tearDown(self): try: @@ -50,11 +51,10 @@ class SmbCaclsBlockboxTestBase(BlackboxTestCase): raise Exception("deltree: failed without setting errcode") except Exception as e: print("remote remove failed: %s" % str(e)) - dirpath = os.path.join(os.environ["LOCAL_PATH"],self.testdir) - print("falling back to removing contents of local dir: %s" % dirpath) - if os.path.exists(dirpath): - for entry in os.listdir(dirpath): - fullpath = os.path.join(dirpath, entry) + print("falling back to removing contents of local dir: %s" % self.dirpath) + if os.path.exists(self.dirpath): + for entry in os.listdir(self.dirpath): + fullpath = os.path.join(self.dirpath, entry) if os.path.isdir(fullpath): import shutil shutil.rmtree(fullpath)