1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
From: Josue Ortega <josue@debian.org>
Date: Thu, 23 Jun 2022 09:40:56 +0200
Subject: Add override teardDown() function to cleanup directory after tests.
This will avoid
Last-Update: 2019-12-30
Forwarded: not-needed
dirty tree module at installation time
---
src/ecdsa/test_pyecdsa.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/ecdsa/test_pyecdsa.py b/src/ecdsa/test_pyecdsa.py
index 799e9b7..7a16d65 100644
--- a/src/ecdsa/test_pyecdsa.py
+++ b/src/ecdsa/test_pyecdsa.py
@@ -99,6 +99,11 @@ def run_openssl(cmd):
class ECDSA(unittest.TestCase):
+
+ def tearDown(self):
+ if os.path.isdir("t"):
+ shutil.rmtree("t")
+
def test_basic(self):
priv = SigningKey.generate()
pub = priv.get_verifying_key()
@@ -1812,6 +1817,10 @@ class TooSmallCurve(unittest.TestCase):
class DER(unittest.TestCase):
+ def tearDown(self):
+ if os.path.isdir("t"):
+ shutil.rmtree("t")
+
def test_integer(self):
self.assertEqual(der.encode_integer(0), b"\x02\x01\x00")
self.assertEqual(der.encode_integer(1), b"\x02\x01\x01")
@@ -1876,6 +1885,10 @@ class DER(unittest.TestCase):
class Util(unittest.TestCase):
+ def tearDown(self):
+ if os.path.isdir("t"):
+ shutil.rmtree("t")
+
@pytest.mark.slow
def test_trytryagain(self):
tta = util.randrange_from_seed__trytryagain
@@ -1942,6 +1955,9 @@ class Util(unittest.TestCase):
class RFC6979(unittest.TestCase):
+ def tearDown(self):
+ if os.path.isdir("t"):
+ shutil.rmtree("t")
# https://tools.ietf.org/html/rfc6979#appendix-A.1
def _do(self, generator, secexp, hsh, hash_func, expected):
actual = rfc6979.generate_k(generator.order(), secexp, hash_func, hsh)
@@ -2144,6 +2160,10 @@ class RFC6979(unittest.TestCase):
class ECDH(unittest.TestCase):
+ def tearDown(self):
+ if os.path.isdir("t"):
+ shutil.rmtree("t")
+
def _do(self, curve, generator, dA, x_qA, y_qA, dB, x_qB, y_qB, x_Z, y_Z):
qA = dA * generator
qB = dB * generator
|