Skip to content

gh-130149: refactor tests for HMAC #130150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d80b1b1
add helper for _hashlib detection
picnixz Feb 13, 2025
73b7756
remove unused function `ignore_warning`
picnixz Feb 13, 2025
fe7a300
cleanup whitespaces
picnixz Feb 13, 2025
72f956f
clean imports and test guards
picnixz Feb 13, 2025
3e827a7
Add mixins for interacting with HMAC
picnixz Feb 13, 2025
7f4fcc8
add mixin for RFC test cases
picnixz Feb 13, 2025
e47dd8b
use RFC mixin classes
picnixz Feb 13, 2025
acda122
refactor `CompareDigestTestCase`
picnixz Feb 13, 2025
d2eb48a
refactor `CopyTestCase`
picnixz Feb 13, 2025
105f6ce
refactor `UpdateTestCase`
picnixz Feb 13, 2025
412f5c2
refactor `SanityTestCase`
picnixz Feb 13, 2025
c682945
refactor `ConstructorTestCase`
picnixz Feb 13, 2025
7e62a58
Merge branch 'main' into test/hmac/refactor-99108
picnixz Feb 15, 2025
c04233d
update comments
picnixz Feb 15, 2025
fb7e577
extend coverage
picnixz Feb 15, 2025
168d018
Merge branch 'main' into test/hmac/refactor-99108
picnixz Feb 24, 2025
4177afa
add regression test for HMAC `repr()`
picnixz Feb 25, 2025
644f577
change a bit the digestmod tests
picnixz Feb 25, 2025
e71f03d
Merge branch 'main' into test/hmac/refactor-99108
picnixz Mar 2, 2025
dbe3ce4
remove mixin that is not yet needed
picnixz Mar 3, 2025
ca0822a
add comments
picnixz Mar 3, 2025
a0b3569
semantics: 'digest' -> 'hexdigest'
picnixz Mar 3, 2025
321a7a9
use `__init_subclass__` instead of `setUpClass`
picnixz Mar 3, 2025
ca7851c
document and reorganize method order in `DigestModTestCaseMixin`
picnixz Mar 3, 2025
a347ee5
use separate factories for creating bad digestmod cases
picnixz Mar 3, 2025
85364b4
minor tweak on `CompareDigestMixin`
picnixz Mar 3, 2025
740fe81
do not allow 'hashfunc' or 'hashname' to be None for RFC tests
picnixz Mar 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Lib/test/support/hashlib_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
_hashlib = None


def requires_hashlib():
return unittest.skipIf(_hashlib is None, "requires _hashlib")


def requires_hashdigest(digestname, openssl=None, usedforsecurity=True):
"""Decorator raising SkipTest if a hashing algorithm is not available

Expand Down Expand Up @@ -44,7 +48,7 @@ def wrapper(*args, **kwargs):
hashlib.new(digestname, usedforsecurity=usedforsecurity)
except ValueError:
raise unittest.SkipTest(
f"hash digest '{digestname}' is not available."
f"hash digest {digestname!r} is not available."
)
return func_or_class(*args, **kwargs)
return wrapper
Expand Down
Loading
Loading