David Marchand, Aug 30, 2023 at 10:16: > 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 <david.march...@redhat.com> > --- > 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
Hi David, Since CryptographyDeprecationWarning is a subclass of UserWarning, you can also that simpler form: warnings.filterwarnings("ignore", r"(blowfish|cast5)", UserWarning) _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev