summaryrefslogtreecommitdiff
path: root/tests/pypi.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-07-26 17:49:34 +0200
committerLudovic Courtès <ludo@gnu.org>2016-07-26 17:49:34 +0200
commit8173ceee1f31ab562118ff5171254a4b73b71400 (patch)
treeeba237bd3f70991c87996dcc24ed998f5d333b58 /tests/pypi.scm
parentdebc6360e111e8efc8a938b2aef28e5b3616ada8 (diff)
downloadpatches-8173ceee1f31ab562118ff5171254a4b73b71400.tar
patches-8173ceee1f31ab562118ff5171254a4b73b71400.tar.gz
import: pypi: Correctly handle new-style URLs.
Fixes <http://bugs.gnu.org/23997>. * guix/import/pypi.scm (guix-package->pypi-name): Rewrite using 'basename' and 'hyphen-package-name->name+version'. * tests/pypi.scm ("guix-package->pypi-name, old URL style") ("guix-package->pypi-name, new URL style"): New tests.
Diffstat (limited to 'tests/pypi.scm')
-rw-r--r--tests/pypi.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/pypi.scm b/tests/pypi.scm
index 379c288394..01d8a575ab 100644
--- a/tests/pypi.scm
+++ b/tests/pypi.scm
@@ -73,6 +73,22 @@ baz > 13.37")
(test-begin "pypi")
+(test-equal "guix-package->pypi-name, old URL style"
+ "psutil"
+ (guix-package->pypi-name
+ (dummy-package "foo"
+ (source (dummy-origin
+ (uri
+ "https://pypi.io/packages/source/p/psutil/psutil-4.3.0.tar.gz"))))))
+
+(test-equal "guix-package->pypi-name, new URL style"
+ "certbot"
+ (guix-package->pypi-name
+ (dummy-package "foo"
+ (source (dummy-origin
+ (uri
+ "https://pypi.python.org/packages/a2/3b/4756e6a0ceb14e084042a2a65c615d68d25621c6fd446d0fc10d14c4ce7d/certbot-0.8.1.tar.gz"))))))
+
(test-assert "pypi->guix-package"
;; Replace network resources with sample data.
(mock ((guix import utils) url-fetch