forked from pool/python-h2
Accepting request 1043739 from devel:languages:python
- add fix-repr-checks-for-py311.patch OBS-URL: https://build.opensuse.org/request/show/1043739 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-h2?expand=0&rev=15
This commit is contained in:
107
fix-repr-checks-for-py311.patch
Normal file
107
fix-repr-checks-for-py311.patch
Normal file
@@ -0,0 +1,107 @@
|
||||
From 8952c91606cd014720ccf202a25b5ee1fbed1591 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
|
||||
Date: Sun, 3 Jul 2022 12:05:05 +0200
|
||||
Subject: [PATCH] Fix repr() checks for Python 3.11
|
||||
|
||||
In Python 3.11, repr() was modified, this commit fixes the
|
||||
assertions to match the new repr() behavior.
|
||||
|
||||
Fix #1268
|
||||
---
|
||||
test/test_events.py | 62 ++++++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 44 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/test/test_events.py b/test/test_events.py
|
||||
index a6e8d8379..c790fbaa0 100644
|
||||
--- a/test/test_events.py
|
||||
+++ b/test/test_events.py
|
||||
@@ -207,11 +207,18 @@ def test_remotesettingschanged_repr(self):
|
||||
),
|
||||
}
|
||||
|
||||
- assert repr(e) == (
|
||||
- "<RemoteSettingsChanged changed_settings:{ChangedSetting("
|
||||
- "setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, "
|
||||
- "new_value=32768)}>"
|
||||
- )
|
||||
+ if sys.version_info >= (3, 11):
|
||||
+ assert repr(e) == (
|
||||
+ "<RemoteSettingsChanged changed_settings:{ChangedSetting("
|
||||
+ "setting=4, original_value=65536, "
|
||||
+ "new_value=32768)}>"
|
||||
+ )
|
||||
+ else:
|
||||
+ assert repr(e) == (
|
||||
+ "<RemoteSettingsChanged changed_settings:{ChangedSetting("
|
||||
+ "setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, "
|
||||
+ "new_value=32768)}>"
|
||||
+ )
|
||||
|
||||
def test_pingreceived_repr(self):
|
||||
"""
|
||||
@@ -249,10 +256,16 @@ def test_streamreset_repr(self):
|
||||
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>"
|
||||
- )
|
||||
+ if sys.version_info >= (3, 11):
|
||||
+ assert repr(e) == (
|
||||
+ "<StreamReset stream_id:919, "
|
||||
+ "error_code:11, remote_reset:False>"
|
||||
+ )
|
||||
+ else:
|
||||
+ assert repr(e) == (
|
||||
+ "<StreamReset stream_id:919, "
|
||||
+ "error_code:ErrorCodes.ENHANCE_YOUR_CALM, remote_reset:False>"
|
||||
+ )
|
||||
|
||||
def test_pushedstreamreceived_repr(self):
|
||||
"""
|
||||
@@ -284,11 +297,18 @@ def test_settingsacknowledged_repr(self):
|
||||
),
|
||||
}
|
||||
|
||||
- assert repr(e) == (
|
||||
- "<SettingsAcknowledged changed_settings:{ChangedSetting("
|
||||
- "setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, "
|
||||
- "new_value=32768)}>"
|
||||
- )
|
||||
+ if sys.version_info >= (3, 11):
|
||||
+ assert repr(e) == (
|
||||
+ "<SettingsAcknowledged changed_settings:{ChangedSetting("
|
||||
+ "setting=4, original_value=65536, "
|
||||
+ "new_value=32768)}>"
|
||||
+ )
|
||||
+ else:
|
||||
+ assert repr(e) == (
|
||||
+ "<SettingsAcknowledged changed_settings:{ChangedSetting("
|
||||
+ "setting=SettingCodes.INITIAL_WINDOW_SIZE, original_value=65536, "
|
||||
+ "new_value=32768)}>"
|
||||
+ )
|
||||
|
||||
def test_priorityupdated_repr(self):
|
||||
"""
|
||||
@@ -318,10 +338,16 @@ def test_connectionterminated_repr(self, additional_data, data_repr):
|
||||
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
|
||||
- )
|
||||
+ if sys.version_info >= (3, 11):
|
||||
+ assert repr(e) == (
|
||||
+ "<ConnectionTerminated error_code:12, "
|
||||
+ "last_stream_id:33, additional_data:%s>" % data_repr
|
||||
+ )
|
||||
+ else:
|
||||
+ assert repr(e) == (
|
||||
+ "<ConnectionTerminated error_code:ErrorCodes.INADEQUATE_SECURITY, "
|
||||
+ "last_stream_id:33, additional_data:%s>" % data_repr
|
||||
+ )
|
||||
|
||||
def test_alternativeserviceavailable_repr(self):
|
||||
"""
|
@@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Dec 19 10:42:29 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- add fix-repr-checks-for-py311.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jan 6 14:23:47 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
|
@@ -25,6 +25,8 @@ Summary: HTTP/2 State-Machine based protocol implementation
|
||||
License: MIT
|
||||
URL: https://github.com/python-hyper/hyper-h2
|
||||
Source0: https://files.pythonhosted.org/packages/source/h/h2/h2-%{version}.tar.gz
|
||||
# Taken from https://github.com/python-hyper/h2/pull/1274
|
||||
Patch1: fix-repr-checks-for-py311.patch
|
||||
BuildRequires: %{python_module hpack >= 2.3}
|
||||
BuildRequires: %{python_module hyperframe >= 6.0}
|
||||
BuildRequires: %{python_module hypothesis >= 5.49}
|
||||
|
Reference in New Issue
Block a user