summary refs log tree commit diff
path: root/tests/pypi.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-05-31 23:50:06 +0200
committerLudovic Courtès <ludo@gnu.org>2023-05-31 23:50:06 +0200
commit654fcf9971bb01389d577be07c6ec0f68940c743 (patch)
tree59ff22f02c9b265adc4b8f596b9924b586895248 /tests/pypi.scm
parent9f7cd1fcaf99c8e8430d0b29335220701664dc54 (diff)
downloadguix-654fcf9971bb01389d577be07c6ec0f68940c743.tar.gz
tests: Use quasiquoted 'match' patterns for package sexps.
Turns out it's easier to read.

* tests/cpan.scm ("cpan->guix-package"): Use a quasiquoted pattern.
* tests/elpa.scm (eval-test-with-elpa): Likewise.
* tests/gem.scm ("gem->guix-package")
("gem->guix-package with a specific version")
("gem-recursive-import")
("gem-recursive-import with a specific version"): Likewise.
* tests/hexpm.scm ("hexpm-recursive-import"): Likewise.
* tests/opam.scm ("opam->guix-package"): Likewise.
* tests/pypi.scm ("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"):
Likewise.
* tests/texlive.scm ("texlive->guix-package"): Likewise.
Diffstat (limited to 'tests/pypi.scm')
-rw-r--r--tests/pypi.scm122
1 files changed, 59 insertions, 63 deletions
diff --git a/tests/pypi.scm b/tests/pypi.scm
index f3b2771f4b..42b39cde73 100644
--- a/tests/pypi.scm
+++ b/tests/pypi.scm
@@ -302,22 +302,21 @@ files specified by SPECS.  Return its file name."
                         ("/foo/json" 200 ,(lambda (port)
                                             (display (foo-json) port)))))
       (match (pypi->guix-package "foo")
-        (('package
-           ('name "python-foo")
-           ('version "1.0.0")
-           ('source ('origin
-                      ('method 'url-fetch)
-                      ('uri ('pypi-uri "foo" 'version))
-                      ('sha256
-                       ('base32
-                        (? string? hash)))))
-           ('build-system 'pyproject-build-system)
-           ('propagated-inputs ('list 'python-bar 'python-foo))
-           ('native-inputs ('list 'python-pytest))
-           ('home-page "http://example.com")
-           ('synopsis "summary")
-           ('description "summary")
-           ('license 'license:lgpl2.0))
+        (`(package
+            (name "python-foo")
+            (version "1.0.0")
+            (source (origin
+                      (method url-fetch)
+                      (uri (pypi-uri "foo" version))
+                      (sha256
+                       (base32 ,(? string? hash)))))
+            (build-system pyproject-build-system)
+            (propagated-inputs (list python-bar python-foo))
+            (native-inputs (list python-pytest))
+            (home-page "http://example.com")
+            (synopsis "summary")
+            (description "summary")
+            (license license:lgpl2.0))
          (and (string=? default-sha256/base32 hash)
               (equal? (pypi->guix-package "foo" #:version "1.0.0")
                       (pypi->guix-package "foo"))
@@ -344,22 +343,21 @@ to make sure we're testing wheels"))))
       ;; computed in the previous test.
       (invalidate-memoization! pypi->guix-package)
       (match (pypi->guix-package "foo")
-        (('package
-           ('name "python-foo")
-           ('version "1.0.0")
-           ('source ('origin
-                      ('method 'url-fetch)
-                      ('uri ('pypi-uri "foo" 'version))
-                      ('sha256
-                       ('base32
-                        (? string? hash)))))
-           ('build-system 'pyproject-build-system)
-           ('propagated-inputs ('list 'python-bar 'python-baz))
-           ('native-inputs ('list 'python-pytest))
-           ('home-page "http://example.com")
-           ('synopsis "summary")
-           ('description "summary")
-           ('license 'license:lgpl2.0))
+        (`(package
+            (name "python-foo")
+            (version "1.0.0")
+            (source (origin
+                      (method url-fetch)
+                      (uri (pypi-uri "foo" version))
+                      (sha256
+                       (base32 ,(? string? hash)))))
+            (build-system pyproject-build-system)
+            (propagated-inputs (list python-bar python-baz))
+            (native-inputs (list python-pytest))
+            (home-page "http://example.com")
+            (synopsis "summary")
+            (description "summary")
+            (license license:lgpl2.0))
          (string=? default-sha256/base32 hash))
         (x
          (pk 'fail x #f))))))
@@ -375,20 +373,19 @@ to make sure we're testing wheels"))))
       ;; value computed in the previous test.
       (invalidate-memoization! pypi->guix-package)
       (match (pypi->guix-package "foo")
-        (('package
-           ('name "python-foo")
-           ('version "1.0.0")
-           ('source ('origin
-                      ('method 'url-fetch)
-                      ('uri ('pypi-uri "foo" 'version))
-                      ('sha256
-                       ('base32
-                        (? string? hash)))))
-           ('build-system 'pyproject-build-system)
-           ('home-page "http://example.com")
-           ('synopsis "summary")
-           ('description "summary")
-           ('license 'license:lgpl2.0))
+        (`(package
+            (name "python-foo")
+            (version "1.0.0")
+            (source (origin
+                       (method url-fetch)
+                       (uri (pypi-uri "foo" version))
+                       (sha256
+                        (base32 ,(? string? hash)))))
+            (build-system pyproject-build-system)
+            (home-page "http://example.com")
+            (synopsis "summary")
+            (description "summary")
+            (license license:lgpl2.0))
          (string=? default-sha256/base32 hash))
         (x
          (pk 'fail x #f))))))
@@ -403,23 +400,22 @@ to make sure we're testing wheels"))))
                                         (display (foo-json #:name "foo-99")
                                                  port))))
       (match (pypi->guix-package "foo-99")
-        (('package
-           ('name "python-foo-99")
-           ('version "1.0.0")
-           ('source ('origin
-                      ('method 'url-fetch)
-                      ('uri ('pypi-uri "foo-99" 'version))
-                      ('sha256
-                       ('base32
-                        (? string? hash)))))
-           ('properties ('quote (("upstream-name" . "foo-99"))))
-           ('build-system 'pyproject-build-system)
-           ('propagated-inputs ('list 'python-bar 'python-foo))
-           ('native-inputs ('list 'python-pytest))
-           ('home-page "http://example.com")
-           ('synopsis "summary")
-           ('description "summary")
-           ('license 'license:lgpl2.0))
+        (`(package
+            (name "python-foo-99")
+            (version "1.0.0")
+            (source (origin
+                      (method url-fetch)
+                      (uri (pypi-uri "foo-99" version))
+                      (sha256
+                       (base32 ,(? string? hash)))))
+            (properties (quote (("upstream-name" . "foo-99"))))
+            (build-system pyproject-build-system)
+            (propagated-inputs (list python-bar python-foo))
+            (native-inputs (list python-pytest))
+            (home-page "http://example.com")
+            (synopsis "summary")
+            (description "summary")
+            (license license:lgpl2.0))
          (string=? default-sha256/base32 hash))
         (x
          (pk 'fail x #f))))))