[Cryptech-Commits] [sw/libhal] branch ksng updated: Decorator doesn't work properly with --all-tests, use runtime check.

git at cryptech.is git at cryptech.is
Sun Apr 30 14:16:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch ksng
in repository sw/libhal.

The following commit(s) were added to refs/heads/ksng by this push:
     new 018b238  Decorator doesn't work properly with --all-tests, use runtime check.
018b238 is described below

commit 018b238e7aac5b4a990a28f49323b821246c9f66
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Thu Apr 27 01:16:45 2017 -0400

    Decorator doesn't work properly with --all-tests, use runtime check.
---
 unit-tests.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/unit-tests.py b/unit-tests.py
index 10aa810..f0f5fb2 100644
--- a/unit-tests.py
+++ b/unit-tests.py
@@ -132,6 +132,10 @@ class TestCase(unittest.TestCase):
         self.endTime = datetime.datetime.now()
         super(TestCase, self).tearDown()
 
+    def skipUnlessAll(self, reason):
+        if not args.all_tests:
+            self.skipTest(reason)
+
 class TextTestResult(unittest.TextTestResult):
 
     def addSuccess(self, test):
@@ -197,15 +201,12 @@ class TestPIN(TestCase):
                 self.assertRaises(HAL_ERROR_FORBIDDEN, hsm.is_logged_in, user2)
         hsm.logout()
 
-    @unittest.skipUnless(args.all_tests, "Slow")
     def test_login_wheel(self):
         self.login_logout(HAL_USER_WHEEL)
 
-    @unittest.skipUnless(args.all_tests, "Slow")
     def test_login_so(self):
         self.login_logout(HAL_USER_SO)
 
-    @unittest.skipUnless(args.all_tests, "Slow")
     def test_login_user(self):
         self.login_logout(HAL_USER_NORMAL)
 
@@ -292,18 +293,19 @@ class TestPKeyGen(TestCaseLoggedIn):
     def test_gen_sign_verify_rsa_1024_sha256(self):
         self.gen_sign_verify_rsa(HAL_DIGEST_ALGORITHM_SHA256, 1024)
 
-    @unittest.skipUnless(args.all_tests, "Slow")
     def test_gen_sign_verify_rsa_2048_sha384(self):
+        self.skipUnlessAll("Slow")
         self.gen_sign_verify_rsa(HAL_DIGEST_ALGORITHM_SHA384, 2048)
 
-    @unittest.skipUnless(args.all_tests, "Hideously slow")
     def test_gen_sign_verify_rsa_4096_sha512(self):
+        self.skipUnlessAll("Hideously slow")
         self.gen_sign_verify_rsa(HAL_DIGEST_ALGORITHM_SHA512, 4096)
 
     def test_gen_unsupported_length(self):
         with self.assertRaises(HAL_ERROR_BAD_ARGUMENTS):
             hsm.pkey_generate_rsa(1028).delete()
 
+
 class TestPKeyHashing(TestCaseLoggedIn):
     """
     Tests involving various ways of doing the hashing for public key operations.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list