summaryrefslogtreecommitdiff
path: root/dev-python/python-gnupg/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-08-25 07:36:27 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-08-25 07:36:27 +0100
commit43793fab84041cfc5c60c0151d1591b8a69fb24a (patch)
tree6208a7f4fc744684fce0f55acbb47511acace498 /dev-python/python-gnupg/files
parent28e3d252dc8ac8a5635206dfefe1cfe05058d1db (diff)
gentoo resync : 25.08.2018
Diffstat (limited to 'dev-python/python-gnupg/files')
-rw-r--r--dev-python/python-gnupg/files/python-gnupg-0.4.3-skip_network_needing_test.patch56
-rw-r--r--dev-python/python-gnupg/files/python-gnupg-0.4.3-use_seperate_keys_directory.patch44
2 files changed, 47 insertions, 53 deletions
diff --git a/dev-python/python-gnupg/files/python-gnupg-0.4.3-skip_network_needing_test.patch b/dev-python/python-gnupg/files/python-gnupg-0.4.3-skip_network_needing_test.patch
index 2e5b4145182f..f6df14348c1a 100644
--- a/dev-python/python-gnupg/files/python-gnupg-0.4.3-skip_network_needing_test.patch
+++ b/dev-python/python-gnupg/files/python-gnupg-0.4.3-skip_network_needing_test.patch
@@ -1,49 +1,51 @@
-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(-)
+# HG changeset patch
+# User Vinay Sajip <vinay_sajip@yahoo.co.uk>
+# Date 1528916733 -3600
+# Node ID f16d4e17cf349cf9ee561e117262a4041e4fe2ee
+# Parent 60ece27e564ef381392dc19a544aa289fb598c7e
+Conditionally skip tests that rely on flaky external servers/networks.
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')
+@@ -1118,7 +1118,7 @@
>>> gpg = GPG(gpgbinary=GPGBINARY, gnupghome="keys")
>>> os.chmod('keys', 0x1C0)
-- >>> result = gpg.recv_keys('pgp.mit.edu', '92905378')
+ >>> result = gpg.recv_keys('pgp.mit.edu', '92905378')
- >>> assert result
-+ >>> result = gpg.recv_keys('pgp.mit.edu', '92905378') # doctest: +SKIP
-+ >>> assert result # doctest: +SKIP
++ >>> if 'NO_EXTERNAL_TESTS' not in os.environ: assert result
"""
result = self.result_map['import'](self)
-@@ -1320,8 +1320,8 @@ class GPG(object):
- >>> GPGBINARY = os.environ.get('GPGBINARY', 'gpg')
+@@ -1321,7 +1321,7 @@
>>> gpg = GPG(gpgbinary=GPGBINARY, gnupghome='keys')
>>> os.chmod('keys', 0x1C0)
-- >>> result = gpg.search_keys('<vinay_sajip@hotmail.com>')
+ >>> 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
++ >>> if 'NO_EXTERNAL_TESTS' not in os.environ: assert result, 'Failed using default keyserver'
>>> #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")
-
+@@ -836,12 +836,13 @@
#@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>')
+- r = self.gpg.search_keys('<vinay_sajip@hotmail.com>')
+- self.assertTrue(r)
+- self.assertTrue('Vinay Sajip <vinay_sajip@hotmail.com>' in r[0]['uids'])
+- r = self.gpg.search_keys('92905378')
+- self.assertTrue(r)
+- self.assertTrue('Vinay Sajip <vinay_sajip@hotmail.com>' in r[0]['uids'])
++ if 'NO_EXTERNAL_TESTS' not in os.environ:
++ r = self.gpg.search_keys('<vinay_sajip@hotmail.com>')
++ self.assertTrue(r)
++ self.assertTrue('Vinay Sajip <vinay_sajip@hotmail.com>' in r[0]['uids'])
++ r = self.gpg.search_keys('92905378')
++ self.assertTrue(r)
++ self.assertTrue('Vinay Sajip <vinay_sajip@hotmail.com>' in r[0]['uids'])
+
+ def test_quote_with_shell(self):
+ "Test shell quoting with a real shell"
diff --git a/dev-python/python-gnupg/files/python-gnupg-0.4.3-use_seperate_keys_directory.patch b/dev-python/python-gnupg/files/python-gnupg-0.4.3-use_seperate_keys_directory.patch
index b5318ede0d87..b57137200990 100644
--- a/dev-python/python-gnupg/files/python-gnupg-0.4.3-use_seperate_keys_directory.patch
+++ b/dev-python/python-gnupg/files/python-gnupg-0.4.3-use_seperate_keys_directory.patch
@@ -1,30 +1,14 @@
# 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.
+# User Vinay Sajip <vinay_sajip@yahoo.co.uk>
+# Date 1534104706 -3600
+# Node ID aeb916c839c0f556dae96bb1136be760ccc19cfe
+# Parent 1a5795e58fe216c1227a11d169dbe4c09c625d15
+Fixed problem with a fixed 'keys' homedir on slow/busy systems (see PR #24).
diff --git a/test_gnupg.py b/test_gnupg.py
--- a/test_gnupg.py
+++ b/test_gnupg.py
-@@ -173,11 +173,7 @@
+@@ -173,11 +173,14 @@
class GPGTestCase(unittest.TestCase):
def setUp(self):
@@ -33,21 +17,29 @@ diff --git a/test_gnupg.py b/test_gnupg.py
- self.assertTrue(os.path.isdir(hd),
- "Not a directory: %s" % hd)
- shutil.rmtree(hd, ignore_errors=True)
-+ hd = tempfile.mkdtemp()
++ if 'STATIC_TEST_HOMEDIR' not in os.environ:
++ hd = tempfile.mkdtemp(prefix='keys-')
++ else:
++ 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)
prepare_homedir(hd)
self.homedir = hd
self.gpg = gpg = gnupg.GPG(gnupghome=hd, gpgbinary=GPGBINARY)
-@@ -193,6 +189,9 @@
+@@ -193,6 +196,10 @@
data_file.write(os.urandom(5120 * 1024))
data_file.close()
+ def tearDown(self):
-+ shutil.rmtree(self.homedir, ignore_errors=True)
++ if 'STATIC_TEST_HOMEDIR' not in os.environ:
++ 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 @@
+@@ -373,7 +380,7 @@
# and the keyring file name has changed.
pkn = 'pubring.kbx'
skn = None