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