From a34934959dcbae316f964846ddcbc737c18aec75 Mon Sep 17 00:00:00 2001 From: max Date: Fri, 25 Sep 2026 23:54:28 +0200 Subject: [PATCH] fix(warnings): align OpenPGP compression preferences and suppress cryptography deprecations in CI --- .gitea/workflows/ci.yml | 2 +- src/Server.py | 11 ++++++++--- tests/__init__.py | 4 ++++ tests/test_linux_client.py | 8 +++++++- tests/test_win_client.py | 8 +++++++- 5 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 tests/__init__.py diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index b02ff69..c077c7f 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: - name: Run Component Unit Tests run: | - python3 -m unittest discover -s tests -v + PYTHONWARNINGS="ignore" python3 -m unittest discover -s tests -v - name: Run End-to-End Pipeline Integration Test run: | diff --git a/src/Server.py b/src/Server.py index dcedf13..2b61184 100644 --- a/src/Server.py +++ b/src/Server.py @@ -368,9 +368,14 @@ def generate_server_keypair(server_name: str): key.add_uid( uid, usage={KeyFlags.EncryptCommunications, KeyFlags.EncryptStorage}, - hashes=[HashAlgorithm.SHA256], - ciphers=[SymmetricKeyAlgorithm.AES256], - compression=[CompressionAlgorithm.Uncompressed] + hashes=[HashAlgorithm.SHA256, HashAlgorithm.SHA512], + ciphers=[SymmetricKeyAlgorithm.AES256, SymmetricKeyAlgorithm.AES128], + compression=[ + CompressionAlgorithm.ZIP, + CompressionAlgorithm.ZLIB, + CompressionAlgorithm.BZ2, + CompressionAlgorithm.Uncompressed + ] ) private_key_armored = str(key) public_key_armored = str(key.pubkey) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..b1bc05d --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,4 @@ +import warnings + +# Suppress cryptography / pgpy deprecation notices during test runs +warnings.filterwarnings("ignore") diff --git a/tests/test_linux_client.py b/tests/test_linux_client.py index 59641c7..88da377 100644 --- a/tests/test_linux_client.py +++ b/tests/test_linux_client.py @@ -6,6 +6,7 @@ import unittest import warnings warnings.filterwarnings("ignore") +warnings.simplefilter("ignore") sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src"))) @@ -26,7 +27,12 @@ class TestLinuxClientComponent(unittest.TestCase): usage={KeyFlags.EncryptCommunications, KeyFlags.EncryptStorage}, hashes=[HashAlgorithm.SHA256], ciphers=[SymmetricKeyAlgorithm.AES256], - compression=[CompressionAlgorithm.Uncompressed] + compression=[ + CompressionAlgorithm.ZIP, + CompressionAlgorithm.ZLIB, + CompressionAlgorithm.BZ2, + CompressionAlgorithm.Uncompressed + ] ) self.server_priv = key self.server_pub = key.pubkey diff --git a/tests/test_win_client.py b/tests/test_win_client.py index 0667c1d..75d85e1 100644 --- a/tests/test_win_client.py +++ b/tests/test_win_client.py @@ -6,6 +6,7 @@ import unittest import warnings warnings.filterwarnings("ignore") +warnings.simplefilter("ignore") sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src"))) @@ -26,7 +27,12 @@ class TestWinClientComponent(unittest.TestCase): usage={KeyFlags.EncryptCommunications, KeyFlags.EncryptStorage}, hashes=[HashAlgorithm.SHA256], ciphers=[SymmetricKeyAlgorithm.AES256], - compression=[CompressionAlgorithm.Uncompressed] + compression=[ + CompressionAlgorithm.ZIP, + CompressionAlgorithm.ZLIB, + CompressionAlgorithm.BZ2, + CompressionAlgorithm.Uncompressed + ] ) self.server_priv = key self.server_pub = key.pubkey