Tests using mfex_fuzzy.py will fail on systems lacking the Python
cryptography library.
cryptography is not required, it is only imported in mfex_fuzzy.py to
silence some warnings when scapy tries to load some libraries.

Fixes: c3ed0bf34b8a ("tests/mfex: Silence Blowfish/CAST5 deprecation warnings.")
Signed-off-by: David Marchand <[email protected]>
---
 tests/mfex_fuzzy.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/mfex_fuzzy.py b/tests/mfex_fuzzy.py
index 30028ba7a0..50b9870641 100755
--- a/tests/mfex_fuzzy.py
+++ b/tests/mfex_fuzzy.py
@@ -3,12 +3,15 @@
 import sys
 import warnings
 
-from cryptography.utils import CryptographyDeprecationWarning
-warnings.filterwarnings(
-    "ignore",
-    category=CryptographyDeprecationWarning,
-    message=r"(blowfish|cast5)",
-)
+try:
+    from cryptography.utils import CryptographyDeprecationWarning
+    warnings.filterwarnings(
+        "ignore",
+        category=CryptographyDeprecationWarning,
+        message=r"(blowfish|cast5)",
+    )
+except ModuleNotFoundError:
+    pass
 
 # flake8: noqa: E402
 from scapy.all import RandMAC, RandIP, PcapWriter, RandIP6, RandShort, fuzz
-- 
2.41.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to