diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-01-25 21:44:23 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-01-25 21:44:23 +0000 |
commit | 02e7621aa9f7162022d8e8b540b8206d716ab4df (patch) | |
tree | 9a7956bf0cc3b8532f3a565e425f2f0a8c413030 | |
parent | afc8c1bb56fe8de72c7620138893f6ceba105093 (diff) | |
parent | 4151d5c89ad808fc87c3c45eadfbb33c964182a7 (diff) | |
download | pbr-02e7621aa9f7162022d8e8b540b8206d716ab4df.tar.gz |
Merge "Use unsafe OpenPGP keys for testing"
-rw-r--r-- | pbr/tests/test_packaging.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py index 948255d..d048a3c 100644 --- a/pbr/tests/test_packaging.py +++ b/pbr/tests/test_packaging.py @@ -39,6 +39,7 @@ # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS import os +import re import sys import tempfile @@ -120,8 +121,25 @@ class GPGKeyFixture(fixtures.Fixture): """) finally: f.close() + # Note that --quick-random (--debug-quick-random in GnuPG 2.x) + # does not have a corresponding preferences file setting and + # must be passed explicitly on the command line instead + gnupg_version_re = re.compile('gpg .* ([12])\.') + gnupg_version = base._run_cmd(['gpg', '--version'], tempdir.path) + for line in gnupg_version[0].split('\n'): + gnupg_version = gnupg_version_re.match(line) + if gnupg_version: + gnupg_version = gnupg_version.group(1) + break + if gnupg_version == '1': + gnupg_random = '--quick-random' + elif gnupg_version == '2': + gnupg_random = '--debug-quick-random' + else: + gnupg_random = '' base._run_cmd( - ['gpg', '--gen-key', '--batch', config_file], tempdir.path) + ['gpg', '--gen-key', '--batch', gnupg_random, config_file], + tempdir.path) class TestPackagingInGitRepoWithCommit(base.BaseTestCase): |