summary refs log tree commit diff
path: root/tests/pypi.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-10-28 22:14:40 +0200
committerLudovic Courtès <ludo@gnu.org>2021-11-11 00:14:30 +0100
commitb20cd80ff1f3c9eb988a0cc27ed9538b68914608 (patch)
tree848ffbccef8d0bdfcfbf72b23855a6d8921d2f88 /tests/pypi.scm
parent650dcc18e7f840a789a6aa06533b4a4ffc06af59 (diff)
downloadguix-b20cd80ff1f3c9eb988a0cc27ed9538b68914608.tar.gz
import: pypi: Allow imports of a specific version.
* guix/import/pypi.scm (latest-version): New procedure.
(latest-source-release): Rename to...
(source-release): ... this.  Add 'version' parameter.
(latest-wheel-release): Rename to...
(wheel-release): ... this.  Add 'version' parameter.
(pypi->guix-package): Honor 'version' parameter.
(pypi-recursive-import): Add 'version' parameter and honor it.
* guix/scripts/import/pypi.scm (guix-import-pypi): Expect a spec.  Pass
it to 'package-name->name+version'.  Pass the 'version' parameter.
* tests/pypi.scm ("pypi->guix-package, no wheel"): Exercise
the #:version parameter.
* doc/guix.texi (Invoking guix import): Document it.
Diffstat (limited to 'tests/pypi.scm')
-rw-r--r--tests/pypi.scm12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/pypi.scm b/tests/pypi.scm
index 70f4298a90..ad869ac31f 100644
--- a/tests/pypi.scm
+++ b/tests/pypi.scm
@@ -260,9 +260,15 @@ Requires-Dist: pytest (>=3.1.0); extra == 'testing'
                      ('synopsis "summary")
                      ('description "summary")
                      ('license 'license:lgpl2.0))
-                   (string=? (bytevector->nix-base32-string
-                              test-source-hash)
-                             hash))
+                   (and (string=? (bytevector->nix-base32-string
+                                   test-source-hash)
+                                  hash)
+                        (equal? (pypi->guix-package "foo" #:version "1.0.0")
+                                (pypi->guix-package "foo"))
+                        (catch 'quit
+                          (lambda ()
+                            (pypi->guix-package "foo" #:version "42"))
+                          (const #t))))
                   (x
                    (pk 'fail x #f))))))