[PATCH 0/3] Update httpx and add pytest-httpx.

  • Done
  • quality assurance status badge
Details
2 participants
  • Hartmut Goebel
  • Vinicius Monego
Owner
unassigned
Submitted by
Vinicius Monego
Severity
normal
V
V
Vinicius Monego wrote on 11 Jan 2022 06:20
(address . guix-patches@gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
20220111052048.33674-1-monego@posteo.net
I am updating httpcore, httpx and pytest-httpx to older versions to keep compatibility with Orange (must be httpx < 0.20 for the latest version). See https://issues.guix.gnu.org/52696for the Orange update on which this one depends.

Vinicius Monego (3):
gnu: python-httpcore: Update to 0.13.7.
gnu: python-httpx: Update to 0.19.0.
gnu: Add python-pytest-httpx.

gnu/packages/python-check.scm | 34 ++++++++++++++++++++++++++++-
gnu/packages/python-web.scm | 41 +++++++++++++++--------------------
2 files changed, 50 insertions(+), 25 deletions(-)


base-commit: 9d613c36de1ea52e745d30bad841b6cdeaca65f4
--
2.30.2
V
V
Vinicius Monego wrote on 11 Jan 2022 06:24
[PATCH 2/3] gnu: python-httpx: Update to 0.19.0.
(address . 53179@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
20220111052429.34592-2-monego@posteo.net
* gnu/packages/python-web.scm (python-httpx): Update to 0.19.0.
[arguments]: Adjust skipped tests in the custom 'check phase.
[propagated-inputs]: Add python-async-generator,
python-charset-normalizer. Remove python-chardet.
---
gnu/packages/python-web.scm | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)

Toggle diff (60 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index ccce679933..c41860f4c9 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -5089,17 +5089,16 @@ Some things HTTP Core does do:
(define-public python-httpx
(package
(name "python-httpx")
- (version "0.16.1")
+ (version "0.19.0")
(source
(origin
- ;; PyPI tarball does not contain tests.
- (method git-fetch)
+ (method git-fetch) ; no tests in PyPI
(uri (git-reference
(url "https://github.com/encode/httpx")
(commit version)))
(file-name (git-file-name name version))
(sha256
- (base32 "00gmq45fckcqkj910bvd7pyqz1mvgsdvz4s0k7dzbnc5czzq1f4a"))))
+ (base32 "1w2wk6f07s6liyhsrq0qjj9vm2khp40kv85x91k70f1a8rwp2k3d"))))
(build-system python-build-system)
(arguments
`(#:phases
@@ -5107,16 +5106,10 @@ Some things HTTP Core does do:
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
- (invoke "pytest" "-vv" "-k"
- ;; These tests try to open an outgoing connection.
+ (invoke "python" "-m" "pytest" "-k"
(string-append
- "not test_connect_timeout"
- " and not test_that_send_cause_async_client_to_be_not_"
- "closed"
- " and not test_that_async_client_caused_warning_when_"
- "being_deleted"
- " and not test_that_send_cause_client_to_be_not_closed"
- " and not test_async_proxy_close"
+ ;; These tests open outgoing connections.
+ "not test_async_proxy_close"
" and not test_sync_proxy_close"))))))))
(native-inputs
(list python-autoflake
@@ -5136,9 +5129,10 @@ Some things HTTP Core does do:
python-trustme
python-uvicorn))
(propagated-inputs
- (list python-brotli
+ (list python-async-generator
+ python-brotli
python-certifi
- python-chardet
+ python-charset-normalizer
python-httpcore
python-idna
python-rfc3986
--
2.30.2
V
V
Vinicius Monego wrote on 11 Jan 2022 06:24
[PATCH 1/3] gnu: python-httpcore: Update to 0.13.7.
(address . 53179@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
20220111052429.34592-1-monego@posteo.net
* gnu/packages/python-web.scm (python-httpcore): Update to 0.13.7.
[native-inputs]: Order alphabetically.
[propagated-inputs]: Add python-anyio.
---
gnu/packages/ebook.scm | 2 +-
gnu/packages/python-web.scm | 17 ++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)

Toggle diff (61 lines)
diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm
index 03671ee902..5a02e79d1a 100644
--- a/gnu/packages/ebook.scm
+++ b/gnu/packages/ebook.scm
@@ -6,7 +6,7 @@
;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020, 2021, 2022 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2020 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2021 la snesne <lasnesne@lagunposprasihopre.org>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 253b68e02c..ccce679933 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -5030,20 +5030,19 @@ and serve updated contents upon changes to the directory.")
(define-public python-httpcore
(package
(name "python-httpcore")
- (version "0.12.2")
+ (version "0.13.7")
(source
(origin
- ;; PyPI tarball does not contain tests.
- (method git-fetch)
+ (method git-fetch) ; no tests in PyPI
(uri (git-reference
(url "https://github.com/encode/httpcore")
- (commit version)))
+ (commit version)))
(file-name (git-file-name name version))
(sha256
- (base32 "1nrwwfdqjfc2a1k3j41cdwkprwvplf95fwmypdl2aq2qgp3209q0"))))
+ (base32 "1qf1kdscqs566qjzkxz9jxn0g30rx3s6jmxvizvc8q44m8rbs4gn"))))
(build-system python-build-system)
(arguments
- `(#:tests? #f ; Tests hang at 98%
+ `(#:tests? #f ; Tests hang at 99%
#:phases
(modify-phases %standard-phases
(replace 'check
@@ -5064,10 +5063,10 @@ and serve updated contents upon changes to the directory.")
python-pytest-asyncio
python-pytest-cov
python-pytest-trio
- python-uvicorn
- python-trustme))
+ python-trustme
+ python-uvicorn))
(propagated-inputs
- (list python-h11 python-h2 python-sniffio python-trio
+ (list python-anyio python-h11 python-h2 python-sniffio python-trio
python-trio-typing))
(home-page "https://github.com/encode/httpcore")
(synopsis "Minimal, low-level HTTP client")

base-commit: 9d613c36de1ea52e745d30bad841b6cdeaca65f4
--
2.30.2
V
V
Vinicius Monego wrote on 11 Jan 2022 06:24
[PATCH 3/3] gnu: Add python-pytest-httpx.
(address . 53179@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
20220111052429.34592-3-monego@posteo.net
* gnu/packages/python-check.scm (python-pytest-httpx): New variable.
---
gnu/packages/python-check.scm | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)

Toggle diff (54 lines)
diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index b4e2765d72..da044b7acb 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -7,7 +7,7 @@
;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com>
-;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020, 2021, 2022 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
@@ -1735,6 +1735,38 @@ execution of a test suite. It will also store a history of all test runs to
help in debugging failures and optimizing the scheduler to improve speed.")
(license license:asl2.0)))
+(define-public python-pytest-httpx
+ (package
+ (name "python-pytest-httpx")
+ (version "0.13.0")
+ (source
+ (origin
+ (method git-fetch) ; no tests in PyPI release
+ (uri (git-reference
+ (url "https://github.com/Colin-b/pytest_httpx")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0lh7df3ysxmjzvx6242xb6qiwpfxrnj70kjmw5sndvzmy5dfpxfc"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ (add-installed-pythonpath inputs outputs)
+ (invoke "python" "-m" "pytest")))))))
+ (propagated-inputs
+ (list python-httpx))
+ (native-inputs
+ (list python-pytest-asyncio python-pytest python-pytest-cov))
+ (home-page "https://colin-b.github.io/pytest_httpx/")
+ (synopsis "Pytest fixture to mock HTTPX")
+ (description "This package provides a Pytest fixture that will make sure
+every @code{httpx} request will be replied to with user provided responses.")
+ (license license:expat)))
+
;; This is only used by python-sanic
(define-public python-pytest-sanic
(package
--
2.30.2
V
V
Vinicius Monego wrote on 14 Jan 2022 22:08
[PATCH v2 1/3] gnu: python-httpcore: Update to 0.13.7.
(address . 53179@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
20220114210846.171922-1-monego@posteo.net
* gnu/packages/python-web.scm (python-httpcore): Update to 0.13.7.
[native-inputs]: Order alphabetically.
[propagated-inputs]: Add python-anyio.
---
Fixed the copyright being added in the wrong file.

gnu/packages/python-web.scm | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

Toggle diff (57 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 708528983c..639470d7d4 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -37,7 +37,7 @@
;;; Copyright © 2020 Holger Peters <holger.peters@posteo.de>
;;; Copyright © 2020 Noisytoot <noisytoot@gmail.com>
;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com>
-;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020, 2021, 2022 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2020 Konrad Hinsen <konrad.hinsen@fastmail.net>
;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
@@ -5124,20 +5124,19 @@ and serve updated contents upon changes to the directory.")
(define-public python-httpcore
(package
(name "python-httpcore")
- (version "0.12.2")
+ (version "0.13.7")
(source
(origin
- ;; PyPI tarball does not contain tests.
- (method git-fetch)
+ (method git-fetch) ; no tests in PyPI
(uri (git-reference
(url "https://github.com/encode/httpcore")
- (commit version)))
+ (commit version)))
(file-name (git-file-name name version))
(sha256
- (base32 "1nrwwfdqjfc2a1k3j41cdwkprwvplf95fwmypdl2aq2qgp3209q0"))))
+ (base32 "1qf1kdscqs566qjzkxz9jxn0g30rx3s6jmxvizvc8q44m8rbs4gn"))))
(build-system python-build-system)
(arguments
- `(#:tests? #f ; Tests hang at 98%
+ `(#:tests? #f ; Tests hang at 99%
#:phases
(modify-phases %standard-phases
(replace 'check
@@ -5158,10 +5157,10 @@ and serve updated contents upon changes to the directory.")
python-pytest-asyncio
python-pytest-cov
python-pytest-trio
- python-uvicorn
- python-trustme))
+ python-trustme
+ python-uvicorn))
(propagated-inputs
- (list python-h11 python-h2 python-sniffio python-trio
+ (list python-anyio python-h11 python-h2 python-sniffio python-trio
python-trio-typing))
(home-page "https://github.com/encode/httpcore")
(synopsis "Minimal, low-level HTTP client")

base-commit: 36f4745dc10e5d0e8b2a62cd2c8439629debae4f
--
2.30.2
V
V
Vinicius Monego wrote on 14 Jan 2022 22:08
[PATCH v2 2/3] gnu: python-httpx: Update to 0.19.0.
(address . 53179@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
20220114210846.171922-2-monego@posteo.net
* gnu/packages/python-web.scm (python-httpx): Update to 0.19.0.
[arguments]: Adjust skipped tests in the custom 'check phase.
[propagated-inputs]: Add python-async-generator,
python-charset-normalizer. Remove python-chardet.
---
gnu/packages/python-web.scm | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)

Toggle diff (60 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 639470d7d4..0a1d6d3d29 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -5183,17 +5183,16 @@ Some things HTTP Core does do:
(define-public python-httpx
(package
(name "python-httpx")
- (version "0.16.1")
+ (version "0.19.0")
(source
(origin
- ;; PyPI tarball does not contain tests.
- (method git-fetch)
+ (method git-fetch) ; no tests in PyPI
(uri (git-reference
(url "https://github.com/encode/httpx")
(commit version)))
(file-name (git-file-name name version))
(sha256
- (base32 "00gmq45fckcqkj910bvd7pyqz1mvgsdvz4s0k7dzbnc5czzq1f4a"))))
+ (base32 "1w2wk6f07s6liyhsrq0qjj9vm2khp40kv85x91k70f1a8rwp2k3d"))))
(build-system python-build-system)
(arguments
`(#:phases
@@ -5201,16 +5200,10 @@ Some things HTTP Core does do:
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
- (invoke "pytest" "-vv" "-k"
- ;; These tests try to open an outgoing connection.
+ (invoke "python" "-m" "pytest" "-k"
(string-append
- "not test_connect_timeout"
- " and not test_that_send_cause_async_client_to_be_not_"
- "closed"
- " and not test_that_async_client_caused_warning_when_"
- "being_deleted"
- " and not test_that_send_cause_client_to_be_not_closed"
- " and not test_async_proxy_close"
+ ;; These tests open outgoing connections.
+ "not test_async_proxy_close"
" and not test_sync_proxy_close"))))))))
(native-inputs
(list python-autoflake
@@ -5230,9 +5223,10 @@ Some things HTTP Core does do:
python-trustme
python-uvicorn))
(propagated-inputs
- (list python-brotli
+ (list python-async-generator
+ python-brotli
python-certifi
- python-chardet
+ python-charset-normalizer
python-httpcore
python-idna
python-rfc3986
--
2.30.2
V
V
Vinicius Monego wrote on 14 Jan 2022 22:08
[PATCH v2 3/3] gnu: Add python-pytest-httpx.
(address . 53179@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
20220114210846.171922-3-monego@posteo.net
* gnu/packages/python-check.scm (python-pytest-httpx): New variable.
---
gnu/packages/python-check.scm | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)

Toggle diff (54 lines)
diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index 181aa8b05c..8df1dd67eb 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -7,7 +7,7 @@
;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com>
-;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020, 2021, 2022 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
@@ -1789,6 +1789,38 @@ execution of a test suite. It will also store a history of all test runs to
help in debugging failures and optimizing the scheduler to improve speed.")
(license license:asl2.0)))
+(define-public python-pytest-httpx
+ (package
+ (name "python-pytest-httpx")
+ (version "0.13.0")
+ (source
+ (origin
+ (method git-fetch) ; no tests in PyPI release
+ (uri (git-reference
+ (url "https://github.com/Colin-b/pytest_httpx")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0lh7df3ysxmjzvx6242xb6qiwpfxrnj70kjmw5sndvzmy5dfpxfc"))))
+ (build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ (add-installed-pythonpath inputs outputs)
+ (invoke "python" "-m" "pytest")))))))
+ (propagated-inputs
+ (list python-httpx))
+ (native-inputs
+ (list python-pytest-asyncio python-pytest python-pytest-cov))
+ (home-page "https://colin-b.github.io/pytest_httpx/")
+ (synopsis "Pytest fixture to mock HTTPX")
+ (description "This package provides a Pytest fixture that will make sure
+every @code{httpx} request will be replied to with user provided responses.")
+ (license license:expat)))
+
;; This is only used by python-sanic
(define-public python-pytest-sanic
(package
--
2.30.2
H
H
Hartmut Goebel wrote on 22 Jun 2022 18:11
Re: bug#53179: [PATCH 0/3] Update httpx and add pytest-httpx.
9aa28517-3084-2d30-c4d2-046bd5613094@crazy-compilers.com
Thanks for submitting these patches. It has been quite a while now and
nobody did review it. Sorry for that. I'm clonsing this since these
packages are already in Guix now.

--
Regards
Hartmut Goebel

| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
?