89 lines
3.2 KiB
Diff
89 lines
3.2 KiB
Diff
|
From 0dc9665f3aa31ff2f4dc0d7fe6838295fa27b2df Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
||
|
Date: Sun, 20 Jan 2013 14:58:30 +0100
|
||
|
Subject: [PATCH] Use quick random source for tests (now with doctests).
|
||
|
|
||
|
Pass --debug-quick-random to gpg in order to enable the fast random
|
||
|
source. Good random is not really useful for tests while it makes them
|
||
|
awfully slow.
|
||
|
---
|
||
|
gnupg.py | 12 ++++++------
|
||
|
test_gnupg.py | 3 ++-
|
||
|
2 files changed, 8 insertions(+), 7 deletions(-)
|
||
|
|
||
|
diff --git a/gnupg.py b/gnupg.py
|
||
|
index e279116..9366961 100644
|
||
|
--- a/gnupg.py
|
||
|
+++ b/gnupg.py
|
||
|
@@ -694,7 +694,7 @@ class GPG(object):
|
||
|
def verify(self, data):
|
||
|
"""Verify the signature on the contents of the string 'data'
|
||
|
|
||
|
- >>> gpg = GPG(gnupghome="keys")
|
||
|
+ >>> gpg = GPG(gnupghome="keys", options=['--debug-quick-random'])
|
||
|
>>> input = gpg.gen_key_input(Passphrase='foo')
|
||
|
>>> key = gpg.gen_key(input)
|
||
|
>>> assert key
|
||
|
@@ -745,7 +745,7 @@ class GPG(object):
|
||
|
|
||
|
>>> import shutil
|
||
|
>>> shutil.rmtree("keys")
|
||
|
- >>> gpg = GPG(gnupghome="keys")
|
||
|
+ >>> gpg = GPG(gnupghome="keys", options=['--debug-quick-random'])
|
||
|
>>> input = gpg.gen_key_input()
|
||
|
>>> result = gpg.gen_key(input)
|
||
|
>>> print1 = result.fingerprint
|
||
|
@@ -798,7 +798,7 @@ class GPG(object):
|
||
|
|
||
|
>>> import shutil
|
||
|
>>> shutil.rmtree("keys")
|
||
|
- >>> gpg = GPG(gnupghome="keys")
|
||
|
+ >>> gpg = GPG(gnupghome="keys", options=['--debug-quick-random'])
|
||
|
>>> result = gpg.recv_keys('pgp.mit.edu', '3FF0DB166A7476EA')
|
||
|
>>> assert result
|
||
|
|
||
|
@@ -848,7 +848,7 @@ class GPG(object):
|
||
|
|
||
|
>>> import shutil
|
||
|
>>> shutil.rmtree("keys")
|
||
|
- >>> gpg = GPG(gnupghome="keys")
|
||
|
+ >>> gpg = GPG(gnupghome="keys", options=['--debug-quick-random'])
|
||
|
>>> input = gpg.gen_key_input()
|
||
|
>>> result = gpg.gen_key(input)
|
||
|
>>> print1 = result.fingerprint
|
||
|
@@ -894,7 +894,7 @@ class GPG(object):
|
||
|
"""Generate a key; you might use gen_key_input() to create the
|
||
|
control input.
|
||
|
|
||
|
- >>> gpg = GPG(gnupghome="keys")
|
||
|
+ >>> gpg = GPG(gnupghome="keys", options=['--debug-quick-random'])
|
||
|
>>> input = gpg.gen_key_input()
|
||
|
>>> result = gpg.gen_key(input)
|
||
|
>>> assert result
|
||
|
@@ -994,7 +994,7 @@ class GPG(object):
|
||
|
>>> import shutil
|
||
|
>>> if os.path.exists("keys"):
|
||
|
... shutil.rmtree("keys")
|
||
|
- >>> gpg = GPG(gnupghome="keys")
|
||
|
+ >>> gpg = GPG(gnupghome="keys", options=['--debug-quick-random'])
|
||
|
>>> input = gpg.gen_key_input(passphrase='foo')
|
||
|
>>> result = gpg.gen_key(input)
|
||
|
>>> print1 = result.fingerprint
|
||
|
diff --git a/test_gnupg.py b/test_gnupg.py
|
||
|
index d5aed97..5258d97 100644
|
||
|
--- a/test_gnupg.py
|
||
|
+++ b/test_gnupg.py
|
||
|
@@ -96,7 +96,8 @@ class GPGTestCase(unittest.TestCase):
|
||
|
"Not a directory: %s" % hd)
|
||
|
shutil.rmtree(hd)
|
||
|
self.homedir = hd
|
||
|
- self.gpg = gnupg.GPG(gnupghome=hd, gpgbinary='gpg')
|
||
|
+ self.gpg = gnupg.GPG(gnupghome=hd, gpgbinary='gpg',
|
||
|
+ options=['--debug-quick-random'])
|
||
|
|
||
|
def test_environment(self):
|
||
|
"Test the environment by ensuring that setup worked"
|
||
|
--
|
||
|
1.8.1.1
|
||
|
|