Skip to content

Commit

Permalink
tests: add basic test for cryptography
Browse files Browse the repository at this point in the history
Add basic test for `cryptography` that uses the high-level API.
  • Loading branch information
rokm committed Apr 18, 2024
1 parent 0aa223a commit 8229249
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ cloudpickle==3.0.0
cloudscraper==1.2.71
# compliance-checker requires cf-units, so same constraints apply.
compliance-checker==5.1.0; sys_platform != 'win32'
cryptography==42.0.5
dash==2.16.1
dash-bootstrap-components==1.6.0
dash-uploader==0.6.0
Expand Down
16 changes: 16 additions & 0 deletions src/_pyinstaller_hooks_contrib/tests/test_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1979,3 +1979,19 @@ def test_opentelemetry(pyi_builder):
with tracer.start_as_current_span("foo"):
print("Hello world!")
""")


# Basic test for cryptography package
@importorskip('cryptography')
def test_cryptography(pyi_builder):
pyi_builder.test_source("""
from cryptography.fernet import Fernet
key = Fernet.generate_key()
f = Fernet(key)
token = f.encrypt(b"This is test.")
print(f"Encrypted message: {token}")
print(f"Decrypted message: {f.decrypt(token)}")
""")

0 comments on commit 8229249

Please sign in to comment.