Subject: [bug#53179] [PATCH 3/3] gnu: Add python-pytest-httpx.

From: Vinicius Monego <[email-masked]>
Date: Tue, 11 Jan 2022 05:24:29 +0000

* gnu/packages/python-check.scm (python-pytest-httpx): New variable.
---
 gnu/packages/python-check.scm | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

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 <[email-masked]>
 ;;; Copyright © 2020 Marius Bakke <[email-masked]>
 ;;; Copyright © 2020 Edouard Klein <[email-masked]>
-;;; Copyright © 2020, 2021 Vinicius Monego <[email-masked]>
+;;; Copyright © 2020, 2021, 2022 Vinicius Monego <[email-masked]>
 ;;; Copyright © 2020 Tanguy Le Carrour <[email-masked]>
 ;;; Copyright © 2021 Sharlatan Hellseher <[email-masked]>
 ;;; Copyright © 2021 Brendan Tildesley <[email-masked]>
@@ -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