mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
tests: pypi: Rewrite tests using a local HTTP server.
* guix/import/pypi.scm (%pypi-base-url): New variable. (pypi-fetch): Use it. * tests/pypi.scm (foo-json): Compute URLs relative to '%local-url'. (test-json-1, test-json-2, test-source-hash): Remove. (file-dump): New procedure. (with-pypi): New macro. ("pypi->guix-package, no wheel") ("pypi->guix-package, wheels") ("pypi->guix-package, no usable requirement file.") ("pypi->guix-package, package name contains \"-\" followed by digits"): Rewrite using 'with-pypi'.
This commit is contained in:
parent
09526da78f
commit
d2f36abd02
2 changed files with 160 additions and 202 deletions
|
@ -55,7 +55,8 @@
|
|||
#:use-module (guix packages)
|
||||
#:use-module (guix upstream)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:export (parse-requires.txt
|
||||
#:export (%pypi-base-url
|
||||
parse-requires.txt
|
||||
parse-wheel-metadata
|
||||
specification->requirement-name
|
||||
guix-package->pypi-name
|
||||
|
@ -67,6 +68,10 @@
|
|||
;; The PyPI API (notice the rhyme) is "documented" at:
|
||||
;; <https://warehouse.readthedocs.io/api-reference/json/>.
|
||||
|
||||
(define %pypi-base-url
|
||||
;; Base URL of the PyPI API.
|
||||
(make-parameter "https://pypi.org/pypi/"))
|
||||
|
||||
(define non-empty-string-or-false
|
||||
(match-lambda
|
||||
("" #f)
|
||||
|
@ -123,7 +128,7 @@
|
|||
|
||||
(define (pypi-fetch name)
|
||||
"Return a <pypi-project> record for package NAME, or #f on failure."
|
||||
(and=> (json-fetch (string-append "https://pypi.org/pypi/" name "/json"))
|
||||
(and=> (json-fetch (string-append (%pypi-base-url) name "/json"))
|
||||
json->pypi-project))
|
||||
|
||||
;; For packages found on PyPI that lack a source distribution.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue