On Wed, Aug 30, 2023 at 11:03 AM Robin Jarry <[email protected]> wrote:
>
> 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 <[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
>
> Hi David,
>
> Since CryptographyDeprecationWarning is a subclass of UserWarning, you
> can also that simpler form:
>
> warnings.filterwarnings("ignore", r"(blowfish|cast5)", UserWarning)

It means waiving more warnings than before, but I don't think it
really matters for this script.
No strong opinion against your proposal.


-- 
David Marchand

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

Reply via email to