diff --git a/tests/hazmat/primitives/test_aead.py b/tests/hazmat/primitives/test_aead.py index 2f0d52d82682..80850b689d35 100644 --- a/tests/hazmat/primitives/test_aead.py +++ b/tests/hazmat/primitives/test_aead.py @@ -37,8 +37,10 @@ def _aead_supported(cls): return False -def large_mmap(): - return mmap.mmap(-1, 2**32, prot=mmap.PROT_READ) +def large_mmap(length: int = 2**32): + # Silencing mypy prot argument warning on Windows, even though this + # function is only used in non-Windows-based tests. + return mmap.mmap(-1, length, prot=mmap.PROT_READ) # type: ignore[call-arg,attr-defined,unused-ignore] @pytest.mark.skipif( diff --git a/tests/hazmat/primitives/test_ciphers.py b/tests/hazmat/primitives/test_ciphers.py index 5fef25b86c0e..20dcb54d1b1d 100644 --- a/tests/hazmat/primitives/test_ciphers.py +++ b/tests/hazmat/primitives/test_ciphers.py @@ -4,7 +4,6 @@ import binascii -import mmap import os import sys @@ -20,6 +19,7 @@ ) from ...utils import load_nist_vectors, load_vectors_from_file +from .test_aead import large_mmap def test_deprecated_ciphers_import_with_warning(): @@ -255,7 +255,7 @@ def test_update_into_buffer_too_small_gcm(self, backend): sys.platform not in {"linux", "darwin"}, reason="mmap required" ) def test_update_auto_chunking(): - large_data = mmap.mmap(-1, 2**29 + 2**20, prot=mmap.PROT_READ) + large_data = large_mmap(length=2**29 + 2**20) key = b"\x00" * 16 c = ciphers.Cipher(AES(key), modes.ECB())