SHA256
14
0
forked from pool/python-h2

Accepting request 944912 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/944912
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-h2?expand=0&rev=14
This commit is contained in:
2022-01-09 21:50:08 +00:00
committed by Git OBS Bridge
5 changed files with 36 additions and 123 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bb7ac7099dd67a857ed52c815a6192b6b1f5ba6b516237fc24a085341340593d
size 2143850

BIN
h2-4.1.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -1,109 +0,0 @@
From 0646279dab694a89562846c810202ce2c0b49be3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 8 Mar 2021 19:16:26 +0100
Subject: [PATCH] Workaround the issues with hypothesis 6.6
Hypothesis 6.6 will produce:
E hypothesis.errors.FailedHealthCheck: test/test_flow_control_window.py::TestAutomaticFlowControl::test_mixing_update_forms uses the 'frame_factory' fixture, which is reset between function calls but not between test cases generated by `@given(...)`. You can change it to a module- or session-scoped fixture if it is safe to reuse; if not we recommend using a context manager inside your test function. See https://docs.pytest.org/en/latest/fixture.html#sharing-test-data for details on fixture scope.
E See https://hypothesis.readthedocs.io/en/latest/healthchecks.html for more information about this. If you want to disable just this health check, add HealthCheck.function_scoped_fixture to the suppress_health_check settings for this test.
Since the tests already workaround the problem,
acknowledging https://github.com/HypothesisWorks/hypothesis-python/issues/377,
we can safely disable the check.
Hypothesis 5.49 introduced the function_scoped_fixture health check value,
hence it is now the lowest required version of hypothesis.
---
test/test_basic_logic.py | 3 ++-
test/test_flow_control_window.py | 7 ++++++-
tox.ini | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/test/test_basic_logic.py b/test/test_basic_logic.py
index fb54fe50..8c8f3b7d 100644
--- a/test/test_basic_logic.py
+++ b/test/test_basic_logic.py
@@ -21,7 +21,7 @@
from . import helpers
-from hypothesis import given
+from hypothesis import given, settings, HealthCheck
from hypothesis.strategies import integers
@@ -790,6 +790,7 @@ def test_headers_are_lowercase(self, frame_factory):
assert c.data_to_send() == expected_frame.serialize()
@given(frame_size=integers(min_value=2**14, max_value=(2**24 - 1)))
+ @settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
def test_changing_max_frame_size(self, frame_factory, frame_size):
"""
When the user changes the max frame size and the change is ACKed, the
diff --git a/test/test_flow_control_window.py b/test/test_flow_control_window.py
index 24b345aa..7a445af1 100644
--- a/test/test_flow_control_window.py
+++ b/test/test_flow_control_window.py
@@ -7,7 +7,7 @@
"""
import pytest
-from hypothesis import given
+from hypothesis import given, settings, HealthCheck
from hypothesis.strategies import integers
import h2.config
@@ -715,6 +715,7 @@ def _setup_connection_and_send_headers(self, frame_factory):
return c
@given(stream_id=integers(max_value=0))
+ @settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
def test_must_acknowledge_for_stream(self, frame_factory, stream_id):
"""
Flow control acknowledgements must be done on a stream ID that is
@@ -740,6 +741,7 @@ def test_must_acknowledge_for_stream(self, frame_factory, stream_id):
)
@given(size=integers(max_value=-1))
+ @settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
def test_cannot_acknowledge_less_than_zero(self, frame_factory, size):
"""
The user must acknowledge at least 0 bytes.
@@ -837,6 +839,7 @@ def test_acknowledging_streams_we_never_saw(self, frame_factory):
c.acknowledge_received_data(2048, stream_id=101)
@given(integers(min_value=1025, max_value=DEFAULT_FLOW_WINDOW))
+ @settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
def test_acknowledging_1024_bytes_when_empty_increments(self,
frame_factory,
increment):
@@ -873,6 +876,7 @@ def test_acknowledging_1024_bytes_when_empty_increments(self,
# This test needs to use a lower cap, because otherwise the algo will
# increment the stream window anyway.
@given(integers(min_value=1025, max_value=(DEFAULT_FLOW_WINDOW // 4) - 1))
+ @settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
def test_connection_only_empty(self, frame_factory, increment):
"""
If the connection flow control window is empty, but the stream flow
@@ -916,6 +920,7 @@ def test_connection_only_empty(self, frame_factory, increment):
assert c.data_to_send() == expected_data
@given(integers(min_value=1025, max_value=DEFAULT_FLOW_WINDOW))
+ @settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
def test_mixing_update_forms(self, frame_factory, increment):
"""
If the user mixes ackowledging data with manually incrementing windows,
diff --git a/tox.ini b/tox.ini
index 69291df6..1f5e538b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -15,7 +15,7 @@ deps =
pytest==6.0.2
pytest-cov==2.10.1
pytest-xdist==2.1.0
- hypothesis>=5.5,<6
+ hypothesis>=5.49,<7
commands =
pytest --cov-report=xml --cov-report=term --cov=h2 {posargs}

View File

@@ -1,3 +1,20 @@
-------------------------------------------------------------------
Thu Jan 6 14:23:47 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 4.1.0
* Support for Python 3.9 has been added.
* Support for Python 3.10 has been added.
* New example for a Python socket HTTP/2 client.
* New `OutputLogger` for use with ``h2.config.logger``. This is
only provided for convenience and not part of the stable API.
* Header validation now rejects empty header names with a
ProtocolError. While hpack decodes such header blocks without
issues, they violate the HTTP semantics.
* Fix TE header name in error message.
- Drop h2-pr1248-disable-hypothesis-healthcheck.patch merged
upstream
- Register hypothesis profile for slow obs executions.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Mar 29 19:50:36 UTC 2021 - Ben Greiner <code@bnavigator.de> Mon Mar 29 19:50:36 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-h2 # spec file for package python-h2
# #
# Copyright (c) 2021 SUSE LLC # Copyright (c) 2022 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -16,16 +16,15 @@
# #
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1 %define skip_python2 1
Name: python-h2 Name: python-h2
Version: 4.0.0 Version: 4.1.0
Release: 0 Release: 0
Summary: HTTP/2 State-Machine based protocol implementation Summary: HTTP/2 State-Machine based protocol implementation
License: MIT License: MIT
URL: https://github.com/python-hyper/hyper-h2 URL: https://github.com/python-hyper/hyper-h2
Source0: https://files.pythonhosted.org/packages/source/h/h2/h2-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/h/h2/h2-%{version}.tar.gz
Patch0: https://github.com/python-hyper/h2/pull/1248.patch#/h2-pr1248-disable-hypothesis-healthcheck.patch
BuildRequires: %{python_module hpack >= 2.3} BuildRequires: %{python_module hpack >= 2.3}
BuildRequires: %{python_module hyperframe >= 6.0} BuildRequires: %{python_module hyperframe >= 6.0}
BuildRequires: %{python_module hypothesis >= 5.49} BuildRequires: %{python_module hypothesis >= 5.49}
@@ -39,13 +38,23 @@ BuildArch: noarch
%description %description
Pure-Python implementation of a HTTP/2 protocol stack. Pure-Python implementation of a HTTP/2 protocol stack.
Its written from the ground up to be embeddable in whatever program It's written from the ground up to be embeddable in whatever program
you choose to use, ensuring that you can speak HTTP/2 regardless of you choose to use, ensuring that you can speak HTTP/2 regardless of
your programming paradigm. your programming paradigm.
%prep %prep
%autosetup -p1 -n h2-%{version} %autosetup -p1 -n h2-%{version}
echo "
# increase test deadline for slow obs executions
import hypothesis
hypothesis.settings.register_profile(
'obs',
deadline=5000,
suppress_health_check=[hypothesis.HealthCheck.too_slow]
)
" >> test/conftest.py
%build %build
%python_build %python_build
@@ -54,16 +63,12 @@ your programming paradigm.
%python_expand %fdupes %{buildroot}%{$python_sitelib} %python_expand %fdupes %{buildroot}%{$python_sitelib}
%check %check
# flaky in OBS %pytest --hypothesis-profile=obs
# - test_changing_max_frame_size
# - test_range_of_acceptable_outputs
# - test_connection_only_empty & test_delegated_eq (hypothesis on s390x)
%pytest -k 'not (test_changing_max_frame_size or test_range_of_acceptable_outputs or test_connection_only_empty or test_delegated_eq)'
%files %{python_files} %files %{python_files}
%license LICENSE %license LICENSE
%doc CHANGELOG.rst README.rst %doc CHANGELOG.rst README.rst
%{python_sitelib}/h2 %{python_sitelib}/h2
%{python_sitelib}/h2-%{version}-py*.egg-info %{python_sitelib}/h2-%{version}*-info
%changelog %changelog