h2
h2 copied to clipboard
Python 3.11.0b1 test failures due to repr() changes (again)
Remember the repr() changes in Python 3.10.0 betas that broke stuff and then were reverted last minute? They strike again in 3.11.0b1:
$ tox -e py311
GLOB sdist-make: /tmp/h2/setup.py
py311 inst-nodeps: /tmp/h2/.tox/.tmp/package/1/h2-4.1.0.zip
py311 installed: attrs==21.4.0,coverage==6.3.2,execnet==1.9.0,h2 @ file:///tmp/h2/.tox/.tmp/package/1/h2-4.1.0.zip,hpack==4.0.0,hyperframe==6.0.1,hypothesis==6.46.3,iniconfig==1.1.1,packaging==21.3,pluggy==1.0.0,py==1.11.0,pyparsing==3.0.9,pytest==6.2.5,pytest-cov==2.12.1,pytest-forked==1.4.0,pytest-xdist==2.5.0,sortedcontainers==2.4.0,toml==0.10.2
py311 run-test-pre: PYTHONHASHSEED='1678785281'
py311 run-test: commands[0] | pytest --cov-report=xml --cov-report=term --cov=h2
========================================================= test session starts =========================================================
platform linux -- Python 3.11.0b1, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
cachedir: .tox/py311/.pytest_cache
rootdir: /tmp/h2, configfile: setup.cfg, testpaths: test
plugins: xdist-2.5.0, cov-2.12.1, forked-1.4.0, hypothesis-6.46.3
collected 1433 items
test/test_basic_logic.py ...................................................................................................... [ 7%]
............................................................................................................................... [ 15%]
............................................................................................................................... [ 24%]
............................ [ 26%]
test/test_closed_streams.py ..................... [ 28%]
test/test_complex_logic.py ................. [ 29%]
test/test_config.py .................................................................. [ 34%]
test/test_events.py .........F...F.F.FF......................... [ 37%]
test/test_exceptions.py . [ 37%]
test/test_flow_control_window.py ............................................. [ 40%]
test/test_h2_upgrade.py ............. [ 41%]
test/test_head_request.py .. [ 41%]
test/test_header_indexing.py .................................................................................................. [ 48%]
............................................................................................................................... [ 57%]
........................................................................... [ 62%]
test/test_informational_responses.py .............................. [ 64%]
test/test_interacting_stacks.py . [ 64%]
test/test_invalid_content_lengths.py ... [ 64%]
test/test_invalid_frame_sequences.py ....................... [ 66%]
test/test_invalid_headers.py .................................................................................................. [ 73%]
............................................................................................................................... [ 81%]
............................................................................................................................... [ 90%]
............ [ 91%]
test/test_priority.py ....................... [ 93%]
test/test_related_events.py ............. [ 94%]
test/test_rfc7838.py ................... [ 95%]
test/test_rfc8441.py . [ 95%]
test/test_settings.py ................................ [ 97%]
test/test_state_machines.py .................. [ 99%]
test/test_stream_reset.py ..... [ 99%]
test/test_utility_functions.py ........ [100%]
============================================================== FAILURES ===============================================================
___________________________________________ TestEventReprs.test_remotesettingschanged_repr ____________________________________________
self = <test.test_events.TestEventReprs object at 0x7f8df9df95d0>
def test_remotesettingschanged_repr(self):
"""
RemoteSettingsChanged has a useful debug representation.
"""
e = h2.events.RemoteSettingsChanged()
e.changed_settings = {
h2.settings.SettingCodes.INITIAL_WINDOW_SIZE:
h2.settings.ChangedSetting(
h2.settings.SettingCodes.INITIAL_WINDOW_SIZE, 2**16, 2**15
),
}
> assert repr(e) == (
"<RemoteSettingsChanged changed_settings:{ChangedSetting("
"setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, "
"new_value=32768)}>"
)
E AssertionError: assert '<RemoteSetti...alue=32768)}>' == '<RemoteSetti...alue=32768)}>'
E Skipping 54 identical leading characters in diff, use -v to show
E - g(setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, new_value=32768)}>
E ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E + g(setting=4, original_value=65536, new_value=32768)}>
E ? ^
test/test_events.py:210: AssertionError
________________________________________________ TestEventReprs.test_streamreset_repr _________________________________________________
self = <test.test_events.TestEventReprs object at 0x7f8df9eb0650>
def test_streamreset_repr(self):
"""
StreamEnded has a useful debug representation.
"""
e = h2.events.StreamReset()
e.stream_id = 919
e.error_code = h2.errors.ErrorCodes.ENHANCE_YOUR_CALM
e.remote_reset = False
> assert repr(e) == (
"<StreamReset stream_id:919, "
"error_code:ErrorCodes.ENHANCE_YOUR_CALM, remote_reset:False>"
)
E AssertionError: assert '<StreamReset..._reset:False>' == '<StreamReset..._reset:False>'
E - <StreamReset stream_id:919, error_code:ErrorCodes.ENHANCE_YOUR_CALM, remote_reset:False>
E ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E + <StreamReset stream_id:919, error_code:11, remote_reset:False>
E ? ^^
test/test_events.py:252: AssertionError
____________________________________________ TestEventReprs.test_settingsacknowledged_repr ____________________________________________
self = <test.test_events.TestEventReprs object at 0x7f8df9d45bd0>
def test_settingsacknowledged_repr(self):
"""
SettingsAcknowledged has a useful debug representation.
"""
e = h2.events.SettingsAcknowledged()
e.changed_settings = {
h2.settings.SettingCodes.INITIAL_WINDOW_SIZE:
h2.settings.ChangedSetting(
h2.settings.SettingCodes.INITIAL_WINDOW_SIZE, 2**16, 2**15
),
}
> assert repr(e) == (
"<SettingsAcknowledged changed_settings:{ChangedSetting("
"setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, "
"new_value=32768)}>"
)
E AssertionError: assert '<SettingsAck...alue=32768)}>' == '<SettingsAck...alue=32768)}>'
E Skipping 53 identical leading characters in diff, use -v to show
E - g(setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, new_value=32768)}>
E ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E + g(setting=4, original_value=65536, new_value=32768)}>
E ? ^
test/test_events.py:287: AssertionError
______________________________________ TestEventReprs.test_connectionterminated_repr[None-None] _______________________________________
self = <test.test_events.TestEventReprs object at 0x7f8df9d017d0>, additional_data = None, data_repr = 'None'
@pytest.mark.parametrize("additional_data,data_repr", [
(None, "None"),
(b'some data', "736f6d652064617461")
])
def test_connectionterminated_repr(self, additional_data, data_repr):
"""
ConnectionTerminated has a useful debug representation.
"""
e = h2.events.ConnectionTerminated()
e.error_code = h2.errors.ErrorCodes.INADEQUATE_SECURITY
e.last_stream_id = 33
e.additional_data = additional_data
> assert repr(e) == (
"<ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, "
"last_stream_id:33, additional_data:%s>" % data_repr
)
E AssertionError: assert '<ConnectionT...al_data:None>' == '<ConnectionT...al_data:None>'
E - <ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, last_stream_id:33, additional_data:None>
E ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E + <ConnectionTerminated error_code:12, last_stream_id:33, additional_data:None>
E ? ^^
test/test_events.py:321: AssertionError
_____________________________ TestEventReprs.test_connectionterminated_repr[some data-736f6d652064617461] _____________________________
self = <test.test_events.TestEventReprs object at 0x7f8df9cde890>, additional_data = b'some data', data_repr = '736f6d652064617461'
@pytest.mark.parametrize("additional_data,data_repr", [
(None, "None"),
(b'some data', "736f6d652064617461")
])
def test_connectionterminated_repr(self, additional_data, data_repr):
"""
ConnectionTerminated has a useful debug representation.
"""
e = h2.events.ConnectionTerminated()
e.error_code = h2.errors.ErrorCodes.INADEQUATE_SECURITY
e.last_stream_id = 33
e.additional_data = additional_data
> assert repr(e) == (
"<ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, "
"last_stream_id:33, additional_data:%s>" % data_repr
)
E AssertionError: assert '<ConnectionT...652064617461>' == '<ConnectionT...652064617461>'
E - <ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, last_stream_id:33, additional_data:736f6d652064617461>
E ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E + <ConnectionTerminated error_code:12, last_stream_id:33, additional_data:736f6d652064617461>
E ? ^^
test/test_events.py:321: AssertionError
----------- coverage: platform linux, python 3.11.0-beta-1 -----------
Name Stmts Miss Branch BrPart Cover Missing
--------------------------------------------------------------------
src/h2/__init__.py 2 0 0 0 100%
src/h2/config.py 53 0 20 0 100%
src/h2/connection.py 622 0 178 0 100%
src/h2/errors.py 23 0 2 0 100%
src/h2/events.py 138 0 56 0 100%
src/h2/exceptions.py 45 0 30 0 100%
src/h2/frame_buffer.py 63 0 26 0 100%
src/h2/settings.py 132 0 72 0 100%
src/h2/stream.py 446 0 110 0 100%
src/h2/utilities.py 225 0 130 0 100%
src/h2/windows.py 36 0 14 0 100%
--------------------------------------------------------------------
TOTAL 1785 0 638 0 100%
Coverage XML written to file coverage.xml
Required test coverage of 100.0% reached. Total coverage: 100.00%
======================================================= short test summary info =======================================================
FAILED test/test_events.py::TestEventReprs::test_remotesettingschanged_repr - AssertionError: assert '<RemoteSetti...alue=32768)}>' ...
FAILED test/test_events.py::TestEventReprs::test_streamreset_repr - AssertionError: assert '<StreamReset..._reset:False>' == '<Strea...
FAILED test/test_events.py::TestEventReprs::test_settingsacknowledged_repr - AssertionError: assert '<SettingsAck...alue=32768)}>' =...
FAILED test/test_events.py::TestEventReprs::test_connectionterminated_repr[None-None] - AssertionError: assert '<ConnectionT...al_da...
FAILED test/test_events.py::TestEventReprs::test_connectionterminated_repr[some data-736f6d652064617461] - AssertionError: assert '<...
============================================= 5 failed, 1428 passed in 1075.64s (0:17:55) =============================================
ERROR: InvocationError for command /tmp/h2/.tox/py311/bin/pytest --cov-report=xml --cov-report=term --cov=h2 (exited with code 1)
_______________________________________________________________ summary _______________________________________________________________
ERROR: py311: commands failed
Previous report: #1253