jborean93 / pyspnego

Python SPNEGO authentication library
MIT License
52 stars 11 forks source link

Test failures with Python 3.11 #42

Closed mgorny closed 2 years ago

mgorny commented 2 years ago

When running the test suite with Python 3.11.0b3, I get the following failures:

FAILED tests/test_asn1.py::test_extract_asn1_tlv_invalid_universal_class - AssertionError: Regex pattern 'Invalid\\ ASN\\.1\\ OCTET\...
FAILED tests/test_asn1.py::test_extract_asn1_invalid_other_class - AssertionError: Regex pattern 'Invalid\\ ASN\\.1\\ tags,\\ actual...
FAILED tests/test_asn1.py::test_get_sequence_value_failure_with_field_name - AssertionError: Regex pattern 'Failed\\ unpacking\\ fie...
FAILED tests/test_asn1.py::test_get_sequence_value_failure_without_field_name - AssertionError: Regex pattern 'Failed\\ unpacking\\ ...
FAILED tests/test_channel_bindings.py::test_channel_bindings_str - assert ("GssChannelBindings initiator_addr(2|b'\\x01\\x02\\x03\\x...
Failure tracebacks ```pytb ============================================================== FAILURES =============================================================== ____________________________________________ test_extract_asn1_tlv_invalid_universal_class ____________________________________________ def test_extract_asn1_tlv_invalid_universal_class(): expected = ( "Invalid ASN.1 OCTET STRING tags, actual tag class TagClass.universal and tag number " "TypeTagNumber.integer" ) with pytest.raises(ValueError, match=re.escape(expected)): > asn1.extract_asn1_tlv( asn1.ASN1Value(asn1.TagClass.universal, False, asn1.TypeTagNumber.integer, b"\x01"), asn1.TagClass.universal, asn1.TypeTagNumber.octet_string, ) expected = ('Invalid ASN.1 OCTET STRING tags, actual tag class TagClass.universal and tag ' 'number TypeTagNumber.integer') tests/test_asn1.py:110: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tlv = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') tag_class = , tag_number = def extract_asn1_tlv( tlv: typing.Union[bytes, ASN1Value], tag_class: TagClass, tag_number: typing.Union[int, TypeTagNumber], ) -> bytes: """Extract the bytes and validates the existing tag of an ASN.1 value.""" if isinstance(tlv, ASN1Value): if tag_class == TagClass.universal: label_name = TypeTagNumber.native_labels().get(tag_number, "Unknown tag type") msg = "Invalid ASN.1 %s tags, actual tag class %s and tag number %s" % ( label_name, tlv.tag_class, tlv.tag_number, ) else: msg = "Invalid ASN.1 tags, actual tag %s and number %s, expecting class %s and number %s" % ( tlv.tag_class, tlv.tag_number, tag_class, tag_number, ) if tlv.tag_class != tag_class or tlv.tag_number != tag_number: > raise ValueError(msg) E ValueError: Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2 label_name = 'OCTET STRING' msg = 'Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2' tag_class = tag_number = tlv = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:151: ValueError During handling of the above exception, another exception occurred: def test_extract_asn1_tlv_invalid_universal_class(): expected = ( "Invalid ASN.1 OCTET STRING tags, actual tag class TagClass.universal and tag number " "TypeTagNumber.integer" ) > with pytest.raises(ValueError, match=re.escape(expected)): E AssertionError: Regex pattern 'Invalid\\ ASN\\.1\\ OCTET\\ STRING\\ tags,\\ actual\\ tag\\ class\\ TagClass\\.universal\\ and\\ tag\\ number\\ TypeTagNumber\\.integer' does not match 'Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2'. expected = ('Invalid ASN.1 OCTET STRING tags, actual tag class TagClass.universal and tag ' 'number TypeTagNumber.integer') tests/test_asn1.py:109: AssertionError ________________________________________________ test_extract_asn1_invalid_other_class ________________________________________________ def test_extract_asn1_invalid_other_class(): expected = ( "Invalid ASN.1 tags, actual tag TagClass.application and number 1024, expecting class " "TagClass.application and number 512" ) with pytest.raises(ValueError, match=re.escape(expected)): > asn1.extract_asn1_tlv( asn1.ASN1Value(asn1.TagClass.application, True, 1024, b"\x01"), asn1.TagClass.application, 512 ) expected = ('Invalid ASN.1 tags, actual tag TagClass.application and number 1024, ' 'expecting class TagClass.application and number 512') tests/test_asn1.py:123: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tlv = ASN1Value(tag_class=, constructed=True, tag_number=1024, b_data=b'\x01') tag_class = , tag_number = 512 def extract_asn1_tlv( tlv: typing.Union[bytes, ASN1Value], tag_class: TagClass, tag_number: typing.Union[int, TypeTagNumber], ) -> bytes: """Extract the bytes and validates the existing tag of an ASN.1 value.""" if isinstance(tlv, ASN1Value): if tag_class == TagClass.universal: label_name = TypeTagNumber.native_labels().get(tag_number, "Unknown tag type") msg = "Invalid ASN.1 %s tags, actual tag class %s and tag number %s" % ( label_name, tlv.tag_class, tlv.tag_number, ) else: msg = "Invalid ASN.1 tags, actual tag %s and number %s, expecting class %s and number %s" % ( tlv.tag_class, tlv.tag_number, tag_class, tag_number, ) if tlv.tag_class != tag_class or tlv.tag_number != tag_number: > raise ValueError(msg) E ValueError: Invalid ASN.1 tags, actual tag 1 and number 1024, expecting class 1 and number 512 msg = ('Invalid ASN.1 tags, actual tag 1 and number 1024, expecting class 1 and ' 'number 512') tag_class = tag_number = 512 tlv = ASN1Value(tag_class=, constructed=True, tag_number=1024, b_data=b'\x01') ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:151: ValueError During handling of the above exception, another exception occurred: def test_extract_asn1_invalid_other_class(): expected = ( "Invalid ASN.1 tags, actual tag TagClass.application and number 1024, expecting class " "TagClass.application and number 512" ) > with pytest.raises(ValueError, match=re.escape(expected)): E AssertionError: Regex pattern 'Invalid\\ ASN\\.1\\ tags,\\ actual\\ tag\\ TagClass\\.application\\ and\\ number\\ 1024,\\ expecting\\ class\\ TagClass\\.application\\ and\\ number\\ 512' does not match 'Invalid ASN.1 tags, actual tag 1 and number 1024, expecting class 1 and number 512'. expected = ('Invalid ASN.1 tags, actual tag TagClass.application and number 1024, ' 'expecting class TagClass.application and number 512') tests/test_asn1.py:122: AssertionError ___________________________________________ test_get_sequence_value_failure_with_field_name ___________________________________________ sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} tag = 1, structure_name = 'Structure', field_name = 'field-name', unpack_func = def get_sequence_value( sequence: typing.Dict[int, ASN1Value], tag: int, structure_name: str, field_name: typing.Optional[str] = None, unpack_func: typing.Optional[typing.Callable[[typing.Union[bytes, ASN1Value]], typing.Any]] = None, ) -> typing.Any: """Gets an optional tag entry in a tagged sequence will a further unpacking of the value.""" if tag not in sequence: return if not unpack_func: return sequence[tag] try: > return unpack_func(sequence[tag]) field_name = 'field-name' sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} structure_name = 'Structure' tag = 1 unpack_func = where = 'field-name in Structure' ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:173: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ value = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') def unpack_asn1_octet_string(value: typing.Union[ASN1Value, bytes]) -> bytes: """Unpacks an ASN.1 OCTET STRING value.""" > return extract_asn1_tlv(value, TagClass.universal, TypeTagNumber.octet_string) value = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:556: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tlv = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') tag_class = , tag_number = def extract_asn1_tlv( tlv: typing.Union[bytes, ASN1Value], tag_class: TagClass, tag_number: typing.Union[int, TypeTagNumber], ) -> bytes: """Extract the bytes and validates the existing tag of an ASN.1 value.""" if isinstance(tlv, ASN1Value): if tag_class == TagClass.universal: label_name = TypeTagNumber.native_labels().get(tag_number, "Unknown tag type") msg = "Invalid ASN.1 %s tags, actual tag class %s and tag number %s" % ( label_name, tlv.tag_class, tlv.tag_number, ) else: msg = "Invalid ASN.1 tags, actual tag %s and number %s, expecting class %s and number %s" % ( tlv.tag_class, tlv.tag_number, tag_class, tag_number, ) if tlv.tag_class != tag_class or tlv.tag_number != tag_number: > raise ValueError(msg) E ValueError: Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2 label_name = 'OCTET STRING' msg = 'Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2' tag_class = tag_number = tlv = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:151: ValueError The above exception was the direct cause of the following exception: def test_get_sequence_value_failure_with_field_name(): input_sequence = asn1.pack_asn1_sequence( [asn1.pack_asn1(asn1.TagClass.context_specific, True, 1, asn1.pack_asn1_integer(1))] ) output_sequence = asn1.unpack_asn1_tagged_sequence(asn1.unpack_asn1(input_sequence)[0]) expected = ( "Failed unpacking field-name in Structure: Invalid ASN.1 OCTET STRING tags, actual tag class " "TagClass.universal and tag number TypeTagNumber.integer" ) with pytest.raises(ValueError, match=re.escape(expected)): > asn1.get_sequence_value(output_sequence, 1, "Structure", "field-name", asn1.unpack_asn1_octet_string) expected = ('Failed unpacking field-name in Structure: Invalid ASN.1 OCTET STRING tags, ' 'actual tag class TagClass.universal and tag number TypeTagNumber.integer') input_sequence = b'0\x05\xa1\x03\x02\x01\x01' output_sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} tests/test_asn1.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} tag = 1, structure_name = 'Structure', field_name = 'field-name', unpack_func = def get_sequence_value( sequence: typing.Dict[int, ASN1Value], tag: int, structure_name: str, field_name: typing.Optional[str] = None, unpack_func: typing.Optional[typing.Callable[[typing.Union[bytes, ASN1Value]], typing.Any]] = None, ) -> typing.Any: """Gets an optional tag entry in a tagged sequence will a further unpacking of the value.""" if tag not in sequence: return if not unpack_func: return sequence[tag] try: return unpack_func(sequence[tag]) except ValueError as e: where = "%s in %s" % (field_name, structure_name) if field_name else structure_name > raise ValueError("Failed unpacking %s: %s" % (where, str(e))) from e E ValueError: Failed unpacking field-name in Structure: Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2 field_name = 'field-name' sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} structure_name = 'Structure' tag = 1 unpack_func = where = 'field-name in Structure' ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:176: ValueError During handling of the above exception, another exception occurred: def test_get_sequence_value_failure_with_field_name(): input_sequence = asn1.pack_asn1_sequence( [asn1.pack_asn1(asn1.TagClass.context_specific, True, 1, asn1.pack_asn1_integer(1))] ) output_sequence = asn1.unpack_asn1_tagged_sequence(asn1.unpack_asn1(input_sequence)[0]) expected = ( "Failed unpacking field-name in Structure: Invalid ASN.1 OCTET STRING tags, actual tag class " "TagClass.universal and tag number TypeTagNumber.integer" ) > with pytest.raises(ValueError, match=re.escape(expected)): E AssertionError: Regex pattern 'Failed\\ unpacking\\ field\\-name\\ in\\ Structure:\\ Invalid\\ ASN\\.1\\ OCTET\\ STRING\\ tags,\\ actual\\ tag\\ class\\ TagClass\\.universal\\ and\\ tag\\ number\\ TypeTagNumber\\.integer' does not match 'Failed unpacking field-name in Structure: Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2'. expected = ('Failed unpacking field-name in Structure: Invalid ASN.1 OCTET STRING tags, ' 'actual tag class TagClass.universal and tag number TypeTagNumber.integer') input_sequence = b'0\x05\xa1\x03\x02\x01\x01' output_sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} tests/test_asn1.py:168: AssertionError _________________________________________ test_get_sequence_value_failure_without_field_name __________________________________________ sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} tag = 1, structure_name = 'Structure', field_name = None, unpack_func = def get_sequence_value( sequence: typing.Dict[int, ASN1Value], tag: int, structure_name: str, field_name: typing.Optional[str] = None, unpack_func: typing.Optional[typing.Callable[[typing.Union[bytes, ASN1Value]], typing.Any]] = None, ) -> typing.Any: """Gets an optional tag entry in a tagged sequence will a further unpacking of the value.""" if tag not in sequence: return if not unpack_func: return sequence[tag] try: > return unpack_func(sequence[tag]) field_name = None sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} structure_name = 'Structure' tag = 1 unpack_func = where = 'Structure' ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:173: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ value = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') def unpack_asn1_octet_string(value: typing.Union[ASN1Value, bytes]) -> bytes: """Unpacks an ASN.1 OCTET STRING value.""" > return extract_asn1_tlv(value, TagClass.universal, TypeTagNumber.octet_string) value = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:556: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tlv = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') tag_class = , tag_number = def extract_asn1_tlv( tlv: typing.Union[bytes, ASN1Value], tag_class: TagClass, tag_number: typing.Union[int, TypeTagNumber], ) -> bytes: """Extract the bytes and validates the existing tag of an ASN.1 value.""" if isinstance(tlv, ASN1Value): if tag_class == TagClass.universal: label_name = TypeTagNumber.native_labels().get(tag_number, "Unknown tag type") msg = "Invalid ASN.1 %s tags, actual tag class %s and tag number %s" % ( label_name, tlv.tag_class, tlv.tag_number, ) else: msg = "Invalid ASN.1 tags, actual tag %s and number %s, expecting class %s and number %s" % ( tlv.tag_class, tlv.tag_number, tag_class, tag_number, ) if tlv.tag_class != tag_class or tlv.tag_number != tag_number: > raise ValueError(msg) E ValueError: Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2 label_name = 'OCTET STRING' msg = 'Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2' tag_class = tag_number = tlv = ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01') ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:151: ValueError The above exception was the direct cause of the following exception: def test_get_sequence_value_failure_without_field_name(): input_sequence = asn1.pack_asn1_sequence( [asn1.pack_asn1(asn1.TagClass.context_specific, True, 1, asn1.pack_asn1_integer(1))] ) output_sequence = asn1.unpack_asn1_tagged_sequence(asn1.unpack_asn1(input_sequence)[0]) expected = ( "Failed unpacking Structure: Invalid ASN.1 OCTET STRING tags, actual tag class " "TagClass.universal and tag number TypeTagNumber.integer" ) with pytest.raises(ValueError, match=re.escape(expected)): > asn1.get_sequence_value(output_sequence, 1, "Structure", unpack_func=asn1.unpack_asn1_octet_string) expected = ('Failed unpacking Structure: Invalid ASN.1 OCTET STRING tags, actual tag ' 'class TagClass.universal and tag number TypeTagNumber.integer') input_sequence = b'0\x05\xa1\x03\x02\x01\x01' output_sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} tests/test_asn1.py:183: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} tag = 1, structure_name = 'Structure', field_name = None, unpack_func = def get_sequence_value( sequence: typing.Dict[int, ASN1Value], tag: int, structure_name: str, field_name: typing.Optional[str] = None, unpack_func: typing.Optional[typing.Callable[[typing.Union[bytes, ASN1Value]], typing.Any]] = None, ) -> typing.Any: """Gets an optional tag entry in a tagged sequence will a further unpacking of the value.""" if tag not in sequence: return if not unpack_func: return sequence[tag] try: return unpack_func(sequence[tag]) except ValueError as e: where = "%s in %s" % (field_name, structure_name) if field_name else structure_name > raise ValueError("Failed unpacking %s: %s" % (where, str(e))) from e E ValueError: Failed unpacking Structure: Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2 field_name = None sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} structure_name = 'Structure' tag = 1 unpack_func = where = 'Structure' ../pyspnego-0.5.3-python3_11/install/usr/lib/python3.11/site-packages/spnego/_asn1.py:176: ValueError During handling of the above exception, another exception occurred: def test_get_sequence_value_failure_without_field_name(): input_sequence = asn1.pack_asn1_sequence( [asn1.pack_asn1(asn1.TagClass.context_specific, True, 1, asn1.pack_asn1_integer(1))] ) output_sequence = asn1.unpack_asn1_tagged_sequence(asn1.unpack_asn1(input_sequence)[0]) expected = ( "Failed unpacking Structure: Invalid ASN.1 OCTET STRING tags, actual tag class " "TagClass.universal and tag number TypeTagNumber.integer" ) > with pytest.raises(ValueError, match=re.escape(expected)): E AssertionError: Regex pattern 'Failed\\ unpacking\\ Structure:\\ Invalid\\ ASN\\.1\\ OCTET\\ STRING\\ tags,\\ actual\\ tag\\ class\\ TagClass\\.universal\\ and\\ tag\\ number\\ TypeTagNumber\\.integer' does not match 'Failed unpacking Structure: Invalid ASN.1 OCTET STRING tags, actual tag class 0 and tag number 2'. expected = ('Failed unpacking Structure: Invalid ASN.1 OCTET STRING tags, actual tag ' 'class TagClass.universal and tag number TypeTagNumber.integer') input_sequence = b'0\x05\xa1\x03\x02\x01\x01' output_sequence = {1: ASN1Value(tag_class=, constructed=False, tag_number=, b_data=b'\x01')} tests/test_asn1.py:182: AssertionError ______________________________________________________ test_channel_bindings_str ______________________________________________________ def test_channel_bindings_str(): actual = str(TEST_DATA) if sys.version_info[0] == 2: assert ( actual == r"GssChannelBindings initiator_addr(AddressType.inet|'\x01\x02\x03\x04') | " r"acceptor_addr(AddressType.unspecified|'\x05\x06\x07\x08') | " r"application_data('caf\xc3\xa9')" ) else: > assert ( actual == r"GssChannelBindings initiator_addr(AddressType.inet|b'\x01\x02\x03\x04') | " r"acceptor_addr(AddressType.unspecified|b'\x05\x06\x07\x08') | " r"application_data(b'caf\xc3\xa9')" ) E assert ("GssChannelBindings initiator_addr(2|b'\\x01\\x02\\x03\\x04') | "\n "acceptor_addr(0|b'\\x05\\x06\\x07\\x08') | "\n "application_data(b'caf\\xc3\\xa9')") == ("GssChannelBindings initiator_addr(AddressType.inet|b'\\x01\\x02\\x03\\x04') "\n "| acceptor_addr(AddressType.unspecified|b'\\x05\\x06\\x07\\x08') | "\n "application_data(b'caf\\xc3\\xa9')") E - GssChannelBindings initiator_addr(AddressType.inet|b'\x01\x02\x03\x04') | acceptor_addr(AddressType.unspecified|b'\x05\x06\x07\x08') | application_data(b'caf\xc3\xa9') E ? ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ E + GssChannelBindings initiator_addr(2|b'\x01\x02\x03\x04') | acceptor_addr(0|b'\x05\x06\x07\x08') | application_data(b'caf\xc3\xa9') E ? ^ ^ actual = ("GssChannelBindings initiator_addr(2|b'\\x01\\x02\\x03\\x04') | " "acceptor_addr(0|b'\\x05\\x06\\x07\\x08') | " "application_data(b'caf\\xc3\\xa9')") tests/test_channel_bindings.py:54: AssertionError ```
mgorny commented 2 years ago

Full build log: log.txt

jborean93 commented 2 years ago

Thanks for the report, I'll look at replicating and fixing the tests sometime soon.

jborean93 commented 2 years ago

These test failures are due to a change in how Python 3.11 stringifies an enum value.

import enum

class MyEnum(enum.IntEnum):
    TEST = 1

print(MyEnum.TEST)

If you run that in Python 3.11 the printed value is 1 whereas in older Python 3 versions it will be MyEnum.TEST. Considering Python 3.11 is still in the beta stages and this to me sounds like a bug on Python itself I'm not sure there's much I should be doing here. I'll keep this open and re-test when the first RC comes out.

jborean93 commented 2 years ago

I've opened an issue on the Cpython issue tracker https://github.com/python/cpython/issues/94763.

mgorny commented 2 years ago

I'm pretty sure that's intentional change. I think you can get a consistent value by using MyEnum.TEST.name and MyEnum.TEST.value.

mgorny commented 2 years ago

Thanks!