[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
56/155: tests: Mock up http-fetch in import test.
From: |
John Darrington |
Subject: |
56/155: tests: Mock up http-fetch in import test. |
Date: |
Wed, 21 Dec 2016 20:48:33 +0000 (UTC) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit 595a20ec6d17b4aecb74519497431b16dc5bd731
Author: Ricardo Wurmus <address@hidden>
Date: Sun Dec 18 10:53:27 2016 +0100
tests: Mock up http-fetch in import test.
This is a follow-up to commit 63773200d7ac68fcaee6efd9ffe8ea7aa3fafa38.
* tests/pypi.scm ("pypi->guix-package, wheels"): Add mock definition of
"http-fetch".
---
tests/pypi.scm | 64 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/tests/pypi.scm b/tests/pypi.scm
index 1f7ac25..f26e7fe 100644
--- a/tests/pypi.scm
+++ b/tests/pypi.scm
@@ -148,10 +148,6 @@ baz > 13.37")
(mock ((guix import utils) url-fetch
(lambda (url file-name)
(match url
- ("https://pypi.python.org/pypi/foo/json"
- (with-output-to-file file-name
- (lambda ()
- (display test-json))))
("https://example.com/foo-1.0.0.tar.gz"
(begin
(mkdir "foo-1.0.0")
@@ -175,31 +171,39 @@ baz > 13.37")
(rename-file zip-file file-name))
(delete-file-recursively "foo-1.0.0.dist-info")))
(_ (error "Unexpected URL: " url)))))
- (match (pypi->guix-package "foo")
- (('package
- ('name "python-foo")
- ('version "1.0.0")
- ('source ('origin
- ('method 'url-fetch)
- ('uri (string-append "https://example.com/foo-"
- version ".tar.gz"))
- ('sha256
- ('base32
- (? string? hash)))))
- ('build-system 'python-build-system)
- ('propagated-inputs
- ('quasiquote
- (("python-bar" ('unquote 'python-bar))
- ("python-baz" ('unquote 'python-baz))
- ("python-setuptools" ('unquote 'python-setuptools)))))
- ('home-page "http://example.com")
- ('synopsis "summary")
- ('description "summary")
- ('license 'license:lgpl2.0))
- (string=? (bytevector->nix-base32-string
- test-source-hash)
- hash))
- (x
- (pk 'fail x #f)))))
+ (mock ((guix http-client) http-fetch
+ (lambda (url)
+ (match url
+ ("https://pypi.python.org/pypi/foo/json"
+ (values (open-input-string test-json)
+ (string-length test-json)))
+ ("https://example.com/foo-1.0.0-py2.py3-none-any.whl" #f)
+ (_ (error "Unexpected URL: " url)))))
+ (match (pypi->guix-package "foo")
+ (('package
+ ('name "python-foo")
+ ('version "1.0.0")
+ ('source ('origin
+ ('method 'url-fetch)
+ ('uri (string-append "https://example.com/foo-"
+ version ".tar.gz"))
+ ('sha256
+ ('base32
+ (? string? hash)))))
+ ('build-system 'python-build-system)
+ ('propagated-inputs
+ ('quasiquote
+ (("python-bar" ('unquote 'python-bar))
+ ("python-baz" ('unquote 'python-baz))
+ ("python-setuptools" ('unquote 'python-setuptools)))))
+ ('home-page "http://example.com")
+ ('synopsis "summary")
+ ('description "summary")
+ ('license 'license:lgpl2.0))
+ (string=? (bytevector->nix-base32-string
+ test-source-hash)
+ hash))
+ (x
+ (pk 'fail x #f))))))
(test-end "pypi")
- 50/155: gnu: sane-backends: Remove timestamps from the output., (continued)
- 50/155: gnu: sane-backends: Remove timestamps from the output., John Darrington, 2016/12/21
- 39/155: import cran: description->package: Also return package dependencies., John Darrington, 2016/12/21
- 45/155: gnu: npth: Update to 1.3., John Darrington, 2016/12/21
- 42/155: import cran: Add "recursive" option., John Darrington, 2016/12/21
- 32/155: profiles: Remove dependency on 'glibc-utf8-locales' for tests., John Darrington, 2016/12/21
- 31/155: gnu: bootstrap: Add FTP URL for bootstrap binaries., John Darrington, 2016/12/21
- 53/155: gnu: youtube-dl: Update to 2016.12.15., John Darrington, 2016/12/21
- 49/155: gnu: Add and use sane-backends., John Darrington, 2016/12/21
- 61/155: tests: Mock up http-fetch., John Darrington, 2016/12/21
- 57/155: gnu: yoshimi: Update to 1.5.0., John Darrington, 2016/12/21
- 56/155: tests: Mock up http-fetch in import test.,
John Darrington <=
- 48/155: gnu: Add and use sane-backends-minimal., John Darrington, 2016/12/21
- 41/155: import cran: Add recursive importer., John Darrington, 2016/12/21
- 67/155: build: Fix .service and .conf targets for VPATH builds., John Darrington, 2016/12/21
- 59/155: linux-initrd: Support FAT filesystems., John Darrington, 2016/12/21
- 55/155: gnu: emacs-org: Update to 20161214., John Darrington, 2016/12/21
- 64/155: doc: Document 'cargo-build-system'., John Darrington, 2016/12/21
- 63/155: gnu: mumble: Update to 1.2.18., John Darrington, 2016/12/21
- 68/155: gnu: maxima: Update to 5.39.0., John Darrington, 2016/12/21
- 65/155: doc: Mention the d3.js backend of 'guix graph'., John Darrington, 2016/12/21
- 71/155: gnu: gnuplot: Update to 5.0.5., John Darrington, 2016/12/21