diff options
author | Conrad Kostecki <conrad@kostecki.com> | 2018-08-13 10:14:13 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2018-08-13 22:41:10 +0200 |
commit | 6defef1480f896546f338dd7b9902d0c397e7507 (patch) | |
tree | 86d8e89cd8e2c295373030612f108464a0b89555 /dev-python | |
parent | app-text/tesseract: 3.05.02 bump (diff) | |
download | gentoo-6defef1480f896546f338dd7b9902d0c397e7507.tar.gz gentoo-6defef1480f896546f338dd7b9902d0c397e7507.tar.bz2 gentoo-6defef1480f896546f338dd7b9902d0c397e7507.zip |
dev-python/python-gnupg: updated patches to match upstream
Bug: https://bugs.gentoo.org/662750
Closes: https://github.com/gentoo/gentoo/pull/9560
Package-Manager: Portage-2.3.45, Repoman-2.3.10
Diffstat (limited to 'dev-python')
3 files changed, 50 insertions, 54 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 diff --git a/dev-python/python-gnupg/python-gnupg-0.4.3.ebuild b/dev-python/python-gnupg/python-gnupg-0.4.3.ebuild index f5deea7ec6ed..419c69562293 100644 --- a/dev-python/python-gnupg/python-gnupg-0.4.3.ebuild +++ b/dev-python/python-gnupg/python-gnupg-0.4.3.ebuild @@ -25,5 +25,7 @@ PATCHES=( ) python_test() { - "${PYTHON}" test_gnupg.py || die "Tests failed with ${EPYTHON}" + # NO_EXTERNAL_TESTS must be enabled, + # to disable all tests, which need internet access. + NO_EXTERNAL_TESTS=1 "${PYTHON}" test_gnupg.py || die "Tests failed with ${EPYTHON}" } |