Skip to content

Commit b9c7e99

Browse files
committed
Skip shake128 tests on JDK 21 java backend
1 parent 467fcbb commit b9c7e99

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎graalpython/lib-python/3/test/test_hashlib.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ def get_fips_mode():
7373
requires_sha3 = unittest.skipUnless(not SKIP_SHA3, 'requires _sha3')
7474

7575

76+
def _has_java_shake():
77+
if getattr(__graalpython__, 'sha3_module_backend', lambda: None)() != 'java':
78+
return True
79+
try:
80+
hashlib.shake_128(usedforsecurity=False)
81+
except _hashlib.UnsupportedDigestmodError:
82+
return False
83+
return True
84+
85+
7686
def hexstr(s):
7787
assert isinstance(s, bytes), repr(s)
7888
h = "0123456789abcdef"
@@ -557,6 +567,8 @@ def test_blocksize_and_name(self):
557567
self.check_blocksize_name('sha384', 128, 48)
558568
self.check_blocksize_name('sha512', 128, 64)
559569

570+
@unittest.skipUnless(_has_java_shake(),
571+
'The java backend requires a JDK or security provider with SHAKE support.')
560572
@requires_sha3
561573
def test_blocksize_name_sha3(self):
562574
self.check_blocksize_name('sha3_224', 144, 28)

0 commit comments

Comments
 (0)