dev-python/python-gnupg: bump to version 0.4.3

Bumped to EAPI="7".
Added pypy3 and python 3.7 support.

Closes: https://bugs.gentoo.org/662750
Closes: https://github.com/gentoo/gentoo/pull/9434
Package-Manager: Portage-2.3.43, Repoman-2.3.10
This commit is contained in:
Conrad Kostecki
2018-08-03 23:33:19 +02:00
committed by Michał Górny
parent 43e64557d1
commit ac293f205a
5 changed files with 150 additions and 9 deletions

View File

@@ -0,0 +1,49 @@
From: Elena Grandi <elena.valhalla@gmail.com>
Date: Thu, 8 Oct 2015 12:11:21 -0700
Subject: Skip tests that require internet access
Forwarded: not-needed
Patch-Name: skip_network_needing_test.patch
---
gnupg.py | 8 ++++----
test_gnupg.py | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/gnupg.py b/gnupg.py
index cd662d4..bf6dc64 100644
--- a/gnupg.py
+++ b/gnupg.py
@@ -1117,8 +1117,8 @@ class GPG(object):
>>> GPGBINARY = os.environ.get('GPGBINARY', 'gpg')
>>> gpg = GPG(gpgbinary=GPGBINARY, gnupghome="keys")
>>> os.chmod('keys', 0x1C0)
- >>> result = gpg.recv_keys('pgp.mit.edu', '92905378')
- >>> assert result
+ >>> result = gpg.recv_keys('pgp.mit.edu', '92905378') # doctest: +SKIP
+ >>> assert result # doctest: +SKIP
"""
result = self.result_map['import'](self)
@@ -1320,8 +1320,8 @@ class GPG(object):
>>> GPGBINARY = os.environ.get('GPGBINARY', 'gpg')
>>> gpg = GPG(gpgbinary=GPGBINARY, gnupghome='keys')
>>> os.chmod('keys', 0x1C0)
- >>> result = gpg.search_keys('<vinay_sajip@hotmail.com>')
- >>> assert result, 'Failed using default keyserver'
+ >>> result = gpg.search_keys('<vinay_sajip@hotmail.com>') # doctest: +SKIP
+ >>> assert result, 'Failed using default keyserver' # doctest: +SKIP
>>> #keyserver = 'keyserver.ubuntu.com'
>>> #result = gpg.search_keys('<vinay_sajip@hotmail.com>', keyserver)
>>> #assert result, 'Failed using keyserver.ubuntu.com'
diff --git a/test_gnupg.py b/test_gnupg.py
index 7a5b705..25817da 100644
--- a/test_gnupg.py
+++ b/test_gnupg.py
@@ -834,6 +834,7 @@ class GPGTestCase(unittest.TestCase):
logger.debug("test_filename_with_spaces ends")
#@skipIf(os.name == 'nt', 'Test not suitable for Windows')
+ @unittest.skip('requires network')
def test_search_keys(self):
"Test that searching for keys works"
r = self.gpg.search_keys('<vinay_sajip@hotmail.com>')

View File

@@ -0,0 +1,58 @@
# HG changeset patch
# User Michał Górny <mgorny@gentoo.org>
# Date 1533916222 -7200
# Node ID 2c8991b1c9080adc61e63d00fe9415b88f3e6208
# Parent 9cb2a856677237b528ead6fff68de7d488dbfeec
Use private temporary GPG-homes for tests to fix race conditions.
Create unique temporary directories to use as GPG home in each test
instead of reusing a single hardcoded 'keys' directory. This is
necessary to fix race conditions between directory operations
and gpg-agent in GnuPG 2.0+.
GnuPG 2.0 started using gpg-agent for all operations. It is
automatically spawned when GPG is called to do something, and it stops
automatically when its homedir is removed (e.g. as part of rmtree()
call). However, with the homedir being instantly recreated and next
test being run, it seems that gpg-agent sometimes failed to stop fully
before being started again and causes one of the tests to fail with
gpg-agent connection errors.
With this change, I am finally able to successfully run all tests
in a single batch.
diff --git a/test_gnupg.py b/test_gnupg.py
--- a/test_gnupg.py
+++ b/test_gnupg.py
@@ -173,11 +173,7 @@
class GPGTestCase(unittest.TestCase):
def setUp(self):
- hd = os.path.join(os.getcwd(), 'keys')
- if os.path.exists(hd):
- self.assertTrue(os.path.isdir(hd),
- "Not a directory: %s" % hd)
- shutil.rmtree(hd, ignore_errors=True)
+ hd = tempfile.mkdtemp()
prepare_homedir(hd)
self.homedir = hd
self.gpg = gpg = gnupg.GPG(gnupghome=hd, gpgbinary=GPGBINARY)
@@ -193,6 +189,9 @@
data_file.write(os.urandom(5120 * 1024))
data_file.close()
+ def tearDown(self):
+ shutil.rmtree(self.homedir, ignore_errors=True)
+
def test_environment(self):
"Test the environment by ensuring that setup worked"
hd = self.homedir
@@ -373,7 +372,7 @@
# and the keyring file name has changed.
pkn = 'pubring.kbx'
skn = None
- hd = os.path.join(os.getcwd(), 'keys')
+ hd = self.homedir
if os.name == 'posix':
pkn = os.path.join(hd, pkn)
if skn: