Accepting request 900750 from home:alarrosa:branches:devel:languages:python

- Update to 0.18.2
  * Added
    - Support for Python 3.10. (Pull #1687)
    - Expose httpx.USE_CLIENT_DEFAULT, used as the default to auth
      and timeout parameters in request methods.
    - Support HTTP/2 "prior knowledge", using
      httpx.Client(http1=False, http2=True).
  * Fixed
    - Clean up some cases where warnings were being issued.
    - Prefer Content-Length over Transfer-Encoding: chunked for
      content= cases.
- Update to 0.18.1
  * Changed
    - Update brotli support to use the brotlicffi package
    - Ensure that Request(..., stream=...) does not auto-generate
      any headers on the request instance.
  * Fixed
    - Pass through timeout=... in top-level httpx.stream()
      function.
    - Map httpcore transport close exceptions to httpx exceptions.
- Add patch (submitted to upstream at gh#encode/httpx#1669) to add
  a pytest marker so we can disable the tests that use the network
  in %check:
  * 0001-Add-a-network-pytest-mark-for-tests-that-use-the-network.patch

OBS-URL: https://build.opensuse.org/request/show/900750
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-httpx?expand=0&rev=3
This commit is contained in:
Steve Kowalik 2021-06-18 11:18:04 +00:00 committed by Git OBS Bridge
parent 79e678f057
commit ab0f76ecff
5 changed files with 104 additions and 8 deletions

View File

@ -0,0 +1,64 @@
From 55b8ee87b0e57f3dda924e3d01ee8eaa39c4aa81 Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <antonio.larrosa@gmail.com>
Date: Mon, 7 Jun 2021 18:32:29 +0200
Subject: [PATCH] Add a network pytest mark for tests that use the network
Sometimes it's useful to have the tests that use the network
marked so they can be skipped easily when we know the network
is not available.
This is useful for example on SUSE and openSUSE's build servers.
When building the httpx packages (actually, any package in the
distribution) the network is disabled so we can assure
reproducible builds (among other benefits). With this mark, it's
easier to skip tests that can not succeed.
---
setup.cfg | 1 +
tests/client/test_proxies.py | 2 ++
tests/test_timeouts.py | 1 +
3 files changed, 4 insertions(+)
diff --git a/setup.cfg b/setup.cfg
index c860d819c..eb5451d96 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -18,6 +18,7 @@ combine_as_imports = True
default:::uvicorn
markers =
copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accodomate e.g. our test setup
+ network: marks tests which require network connection
[coverage:run]
omit = venv/*, httpx/_compat.py
diff --git a/tests/client/test_proxies.py b/tests/client/test_proxies.py
index 6ea4cbe40..2817d202b 100644
--- a/tests/client/test_proxies.py
+++ b/tests/client/test_proxies.py
@@ -122,6 +122,7 @@ def test_transport_for_request(url, proxies, expected):
@pytest.mark.asyncio
+@pytest.mark.network
async def test_async_proxy_close():
try:
client = httpx.AsyncClient(proxies={"https://": PROXY_URL})
@@ -130,6 +131,7 @@ async def test_async_proxy_close():
await client.aclose()
+@pytest.mark.network
def test_sync_proxy_close():
try:
client = httpx.Client(proxies={"https://": PROXY_URL})
diff --git a/tests/test_timeouts.py b/tests/test_timeouts.py
index 46a8bee8f..c7a665c3b 100644
--- a/tests/test_timeouts.py
+++ b/tests/test_timeouts.py
@@ -23,6 +23,7 @@ async def test_write_timeout(server):
@pytest.mark.usefixtures("async_environment")
+@pytest.mark.network
async def test_connect_timeout(server):
timeout = httpx.Timeout(None, connect=1e-6)

View File

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

3
httpx-0.18.2.tar.gz Normal file
View File

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

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Fri Jun 18 07:56:56 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- Update to 0.18.2
* Added
- Support for Python 3.10. (Pull #1687)
- Expose httpx.USE_CLIENT_DEFAULT, used as the default to auth
and timeout parameters in request methods.
- Support HTTP/2 "prior knowledge", using
httpx.Client(http1=False, http2=True).
* Fixed
- Clean up some cases where warnings were being issued.
- Prefer Content-Length over Transfer-Encoding: chunked for
content= cases.
- Update to 0.18.1
* Changed
- Update brotli support to use the brotlicffi package
- Ensure that Request(..., stream=...) does not auto-generate
any headers on the request instance.
* Fixed
- Pass through timeout=... in top-level httpx.stream()
function.
- Map httpcore transport close exceptions to httpx exceptions.
- Add patch (submitted to upstream at gh#encode/httpx#1669) to add
a pytest marker so we can disable the tests that use the network
in %check:
* 0001-Add-a-network-pytest-mark-for-tests-that-use-the-network.patch
-------------------------------------------------------------------
Thu Jun 3 15:15:51 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -20,17 +20,19 @@
%define skip_python2 1
%define skip_python36 1
Name: python-httpx
Version: 0.18.0
Version: 0.18.2
Release: 0
Summary: Python HTTP client with async support
License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://github.com/encode/httpx
Source: https://github.com/encode/httpx/archive/%{version}.tar.gz#/httpx-%{version}.tar.gz
# PATCH-FIX-UPSTREAM alarrosa@suse.com (gh#encode/httpx#1669)
Patch0: 0001-Add-a-network-pytest-mark-for-tests-that-use-the-network.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-Brotli >= 0.7.0
Requires: python-brotlicffi
Requires: python-certifi
Requires: python-chardet >= 3.0
Requires: python-h11 >= 0.8.0
@ -42,7 +44,7 @@ Requires: python-rfc3986 >= 1.3
Requires: python-sniffio
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Brotli >= 0.7.0}
BuildRequires: %{python_module brotlicffi}
BuildRequires: %{python_module async_generator}
BuildRequires: %{python_module certifi}
BuildRequires: %{python_module chardet >= 3.0}
@ -68,6 +70,7 @@ Python HTTP client with async support.
%prep
%setup -q -n httpx-%{version}
%patch0 -p1
rm setup.cfg
%build
@ -78,8 +81,7 @@ rm setup.cfg
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# test_start_tls_on_*_socket_stream and test_connect_timeout require network
%pytest -k 'not (test_start_tls_on_tcp_socket_stream or test_start_tls_on_uds_socket_stream or test_connect_timeout or test_async_proxy_close or test_sync_proxy_close)'
%pytest -k 'not network'
%files %{python_files}
%doc CHANGELOG.md README.md