summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2026-01-24 17:07:10 +0100
committerAndreas Enge <andreas@enge.fr>2026-02-07 12:28:41 +0100
commit483ee41756f332b1a02b218ccac97c296a99de3b (patch)
treeceb80c314802273be0c2349691665bb62e704aa2 /tests
parent5cafd2bdb0919452f6dd9151f816d4681db571e0 (diff)
import: pypi: Fix tests.
* guix/import/pypi.scm (unzip-command): Use invoke instead of system*. (read-wheel-metadata): Adapt accordingly. (guess-requirements-from-wheel): Improve readability. * tests/import/pypi.scm (parse-wheel-metadata): Add test (used to isolate the issue in another test). (pypi->guix-package, no wheel): Remove python-wheel from the result. (pypi->guix-package, no usable requirement file, no wheel.): Likewise. (pypi->guix-package, package name contains \"-\" followed by digits): Likewise. (package-latest-release): Likewise. (pypi->guix-package, no requires.txt, but wheel): Likewise. Also improve readability. Change-Id: I49e6ae549437a068acd85fa0f13471bc0af5a399 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/import/pypi.scm24
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/import/pypi.scm b/tests/import/pypi.scm
index 8da15edcd98..c8f554934b5 100644
--- a/tests/import/pypi.scm
+++ b/tests/import/pypi.scm
@@ -270,6 +270,12 @@ files specified by SPECS. Return its file name."
270 call-with-input-string) 270 call-with-input-string)
271 (parse-requires.txt test-requires.txt-beaker))) 271 (parse-requires.txt test-requires.txt-beaker)))
272 272
273(test-equal "parse-wheel-metadata"
274 (list '("baz" "bar") '("pytest"))
275 (mock ((ice-9 ports) call-with-input-file
276 call-with-input-string)
277 (parse-wheel-metadata test-metadata)))
278
273(test-equal "parse-wheel-metadata, with extras" 279(test-equal "parse-wheel-metadata, with extras"
274 (list '("wrapt" "bar") '("tox" "bumpversion")) 280 (list '("wrapt" "bar") '("tox" "bumpversion"))
275 (mock ((ice-9 ports) call-with-input-file 281 (mock ((ice-9 ports) call-with-input-file
@@ -328,8 +334,7 @@ files specified by SPECS. Return its file name."
328 (build-system pyproject-build-system) 334 (build-system pyproject-build-system)
329 (propagated-inputs (list python-bar python-foo)) 335 (propagated-inputs (list python-bar python-foo))
330 (native-inputs (list python-pytest 336 (native-inputs (list python-pytest
331 python-setuptools 337 python-setuptools))
332 python-wheel))
333 (home-page "https://example.com") 338 (home-page "https://example.com")
334 (synopsis "summary") 339 (synopsis "summary")
335 (description "summary.") 340 (description "summary.")
@@ -431,8 +436,7 @@ files specified by SPECS. Return its file name."
431 (with-pypi `(("/foo-1.0.0.tar.gz" 200 ,(file-dump tarball)) 436 (with-pypi `(("/foo-1.0.0.tar.gz" 200 ,(file-dump tarball))
432 ("/foo-1.0.0-py2.py3-none-any.whl" 437 ("/foo-1.0.0-py2.py3-none-any.whl"
433 200 ,(file-dump wheel)) 438 200 ,(file-dump wheel))
434 ("/foo/json" 200 ,(lambda (port) 439 ("/foo/json" 200 ,(cut display (foo-json) <>)))
435 (display (foo-json) port))))
436 ;; Not clearing the memoization cache here would mean returning the value 440 ;; Not clearing the memoization cache here would mean returning the value
437 ;; computed in the previous test. 441 ;; computed in the previous test.
438 (invalidate-memoization! pypi->guix-package) 442 (invalidate-memoization! pypi->guix-package)
@@ -448,8 +452,7 @@ files specified by SPECS. Return its file name."
448 (build-system pyproject-build-system) 452 (build-system pyproject-build-system)
449 (propagated-inputs (list python-bar python-baz)) 453 (propagated-inputs (list python-bar python-baz))
450 (native-inputs (list python-pytest 454 (native-inputs (list python-pytest
451 python-setuptools 455 python-setuptools))
452 python-wheel))
453 (home-page "https://example.com") 456 (home-page "https://example.com")
454 (synopsis "summary") 457 (synopsis "summary")
455 (description "summary.") 458 (description "summary.")
@@ -478,7 +481,7 @@ files specified by SPECS. Return its file name."
478 (sha256 481 (sha256
479 (base32 ,(? string? hash))))) 482 (base32 ,(? string? hash)))))
480 (build-system pyproject-build-system) 483 (build-system pyproject-build-system)
481 (native-inputs (list python-setuptools python-wheel)) 484 (native-inputs (list python-setuptools))
482 (home-page "https://example.com") 485 (home-page "https://example.com")
483 (synopsis "summary") 486 (synopsis "summary")
484 (description "summary.") 487 (description "summary.")
@@ -509,8 +512,7 @@ files specified by SPECS. Return its file name."
509 (build-system pyproject-build-system) 512 (build-system pyproject-build-system)
510 (propagated-inputs (list python-bar python-foo)) 513 (propagated-inputs (list python-bar python-foo))
511 (native-inputs (list python-pytest 514 (native-inputs (list python-pytest
512 python-setuptools 515 python-setuptools))
513 python-wheel))
514 (home-page "https://example.com") 516 (home-page "https://example.com")
515 (synopsis "summary") 517 (synopsis "summary")
516 (description "summary.") 518 (description "summary.")
@@ -537,10 +539,6 @@ files specified by SPECS. Return its file name."
537 (upstream-input 539 (upstream-input
538 (name "setuptools") 540 (name "setuptools")
539 (downstream-name "python-setuptools") 541 (downstream-name "python-setuptools")
540 (type 'native))
541 (upstream-input
542 (name "wheel")
543 (downstream-name "python-wheel")
544 (type 'native)))) 542 (type 'native))))
545 (let ((tarball (pypi-tarball 543 (let ((tarball (pypi-tarball
546 "foo-1.0.0" 544 "foo-1.0.0"