From: Leonardo Sandoval Date: Tue, 26 Sep 2017 19:36:03 +0000 (-0700) Subject: selftest/cases/signing: ignore removal errors when cleaning temporary gpg directory X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=e7f139c5d97a3871215c88c5bfc07ecf4e8fd7f3;p=openembedded-core.git selftest/cases/signing: ignore removal errors when cleaning temporary gpg directory The high-level method tempfile.TemporaryDirectory give us no way to ignore erros on removal thus use tempfile.mkdtemp instead. Ignoring possible issues on removal is neccesary because it contains gpg sockets that are automatically removed by the system once the process terminates, otherwise the following log is observed: .. .. File "/usr/lib/python3.5/shutil.py", line 436, in _rmtree_safe_fd os.unlink(name, dir_fd=topfd) FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.browser' [YOCTO #11821] Signed-off-by: Leonardo Sandoval Signed-off-by: Armin Kuster --- diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py index 606bfd3e99..3b5c2da0e0 100644 --- a/meta/lib/oeqa/selftest/signing.py +++ b/meta/lib/oeqa/selftest/signing.py @@ -21,14 +21,17 @@ class Signing(oeSelfTest): if not shutil.which("gpg"): raise AssertionError("This test needs GnuPG") - cls.gpg_home_dir = tempfile.TemporaryDirectory(prefix="oeqa-signing-") - cls.gpg_dir = cls.gpg_home_dir.name + cls.gpg_dir = tempfile.mkdtemp(prefix="oeqa-signing-") cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.pub") cls.secret_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.secret") runCmd('gpg --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path)) + @classmethod + def tearDownClass(cls): + shutil.rmtree(cls.gpg_dir, ignore_errors=True) + @testcase(1362) def test_signing_packages(self): """