diff mbox series

[ovs-dev] tests/mfex: Rertain support for cryptography pre-v37.

Message ID 20230321135616.86882-1-mkp@redhat.com
State Accepted
Headers show
Series [ovs-dev] tests/mfex: Rertain support for cryptography pre-v37. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Mike Pattrick March 21, 2023, 1:56 p.m. UTC
Prior to v37.0.0, CryptographyDeprecationWarning could not be imported
from __init__.py resulting in:

Traceback (most recent call last):
  File "mfex_fuzzy.py", line 9, in <module>
    category=cryptography.CryptographyDeprecationWarning,
AttributeError: module 'cryptography' has no attribute
    'CryptographyDeprecationWarning'

This import was only added to __init__ to deprecate python3.6. Importing
the exception from cryptography.utils is the compatible option.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
---
 tests/mfex_fuzzy.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Eelco Chaudron March 22, 2023, 1:07 p.m. UTC | #1
On 21 Mar 2023, at 14:56, Mike Pattrick wrote:

> Prior to v37.0.0, CryptographyDeprecationWarning could not be imported
> from __init__.py resulting in:
>
> Traceback (most recent call last):
>   File "mfex_fuzzy.py", line 9, in <module>
>     category=cryptography.CryptographyDeprecationWarning,
> AttributeError: module 'cryptography' has no attribute
>     'CryptographyDeprecationWarning'
>
> This import was only added to __init__ to deprecate python3.6. Importing
> the exception from cryptography.utils is the compatible option.
>
> Signed-off-by: Mike Pattrick <mkp@redhat.com>

Change looks good to me.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Ilya Maximets March 22, 2023, 8:23 p.m. UTC | #2
On 3/22/23 14:07, Eelco Chaudron wrote:
> 
> 
> On 21 Mar 2023, at 14:56, Mike Pattrick wrote:
> 
>> Prior to v37.0.0, CryptographyDeprecationWarning could not be imported
>> from __init__.py resulting in:
>>
>> Traceback (most recent call last):
>>   File "mfex_fuzzy.py", line 9, in <module>
>>     category=cryptography.CryptographyDeprecationWarning,
>> AttributeError: module 'cryptography' has no attribute
>>     'CryptographyDeprecationWarning'
>>
>> This import was only added to __init__ to deprecate python3.6. Importing
>> the exception from cryptography.utils is the compatible option.
>>
>> Signed-off-by: Mike Pattrick <mkp@redhat.com>
> 
> Change looks good to me.
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>

Applied.  Thanks!

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/tests/mfex_fuzzy.py b/tests/mfex_fuzzy.py
index 15f7f4e51..30028ba7a 100755
--- a/tests/mfex_fuzzy.py
+++ b/tests/mfex_fuzzy.py
@@ -3,12 +3,13 @@ 
 import sys
 import warnings
 
-import cryptography
+from cryptography.utils import CryptographyDeprecationWarning
 warnings.filterwarnings(
     "ignore",
-    category=cryptography.CryptographyDeprecationWarning,
+    category=CryptographyDeprecationWarning,
     message=r"(blowfish|cast5)",
 )
+
 # flake8: noqa: E402
 from scapy.all import RandMAC, RandIP, PcapWriter, RandIP6, RandShort, fuzz
 from scapy.all import IPv6, Dot1Q, IP, Ether, UDP, TCP, random