summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorLeonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>2017-09-07 15:52:54 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-12 23:55:29 +0100
commitf44dfe63a49675e51a72ba271771c1c26650cb43 (patch)
treee71b400600ff7b45b9911decd4d286ae7237643d /meta/lib
parentfae168d2886f7dc1e0df6f85c226b75c87beff36 (diff)
downloadpoky-f44dfe63a49675e51a72ba271771c1c26650cb43.tar.gz
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] (From OE-Core rev: 7e3a7cd2426feac757def81850dc44156cd0f33e) Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/cases/signing.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py
index edb5f653f2..b3d1a8292e 100644
--- a/meta/lib/oeqa/selftest/cases/signing.py
+++ b/meta/lib/oeqa/selftest/cases/signing.py
@@ -22,14 +22,17 @@ class Signing(OESelftestTestCase):
22 if not shutil.which("gpg"): 22 if not shutil.which("gpg"):
23 raise AssertionError("This test needs GnuPG") 23 raise AssertionError("This test needs GnuPG")
24 24
25 cls.gpg_home_dir = tempfile.TemporaryDirectory(prefix="oeqa-signing-") 25 cls.gpg_dir = tempfile.mkdtemp(prefix="oeqa-signing-")
26 cls.gpg_dir = cls.gpg_home_dir.name
27 26
28 cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.pub") 27 cls.pub_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.pub")
29 cls.secret_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.secret") 28 cls.secret_key_path = os.path.join(cls.testlayer_path, 'files', 'signing', "key.secret")
30 29
31 runCmd('gpg --batch --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path)) 30 runCmd('gpg --batch --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path))
32 31
32 @classmethod
33 def tearDownClass(cls):
34 shutil.rmtree(cls.gpg_dir, ignore_errors=True)
35
33 @OETestID(1362) 36 @OETestID(1362)
34 def test_signing_packages(self): 37 def test_signing_packages(self):
35 """ 38 """