mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-27 14:52:05 -05:00
a9edb211e7
Before that '.log' files for scheme tests were fragmented and not included in test-suite.log. This unifies the semantics of SRFI-64 API with Automake test suite. * build-aux/test-driver.scm: New file. * Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables. (SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables. (AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0. * test-env.in: Silence guix-daemon. * doc/guix.texi (Running the Test Suite): Describe how to display the detailed results. Bug reports require only 'test-suite.log' file. * tests/base32.scm, tests/build-utils.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm, tests/cve.scm, tests/derivations.scm, tests/elpa.scm, tests/file-systems.scm, tests/gem.scm, tests/gexp.scm, tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm, tests/gremlin.scm, tests/hackage.scm, tests/hash.scm, tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm, tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm, tests/profiles.scm, tests/publish.scm, tests/pypi.scm, tests/records.scm, tests/scripts-build.scm, tests/scripts.scm, tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm, tests/store.scm, tests/substitute.scm, tests/syscalls.scm, tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm, tests/utils.scm: Don't exit at the end of test groups. * tests/containers.scm: Likewise. Use 'test-skip' instead of exiting with error code 77.
108 lines
3.4 KiB
Scheme
108 lines
3.4 KiB
Scheme
;;; GNU Guix --- Functional package management for GNU
|
|
;;; Copyright © 2014 David Thompson <davet@gnu.org>
|
|
;;;
|
|
;;; This file is part of GNU Guix.
|
|
;;;
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
;;; under the terms of the GNU General Public License as published by
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
;;; your option) any later version.
|
|
;;;
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;;; GNU General Public License for more details.
|
|
;;;
|
|
;;; You should have received a copy of the GNU General Public License
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
(define-module (test-pypi)
|
|
#:use-module (guix import pypi)
|
|
#:use-module (guix base32)
|
|
#:use-module (guix hash)
|
|
#:use-module (guix tests)
|
|
#:use-module ((guix build utils) #:select (delete-file-recursively))
|
|
#:use-module (srfi srfi-64)
|
|
#:use-module (ice-9 match))
|
|
|
|
(define test-json
|
|
"{
|
|
\"info\": {
|
|
\"version\": \"1.0.0\",
|
|
\"name\": \"foo\",
|
|
\"license\": \"GNU LGPL\",
|
|
\"summary\": \"summary\",
|
|
\"home_page\": \"http://example.com\",
|
|
},
|
|
\"releases\": {
|
|
\"1.0.0\": [
|
|
{
|
|
\"url\": \"https://example.com/foo-1.0.0.egg\",
|
|
\"packagetype\": \"bdist_egg\",
|
|
}, {
|
|
\"url\": \"https://example.com/foo-1.0.0.tar.gz\",
|
|
\"packagetype\": \"sdist\",
|
|
}
|
|
]
|
|
}
|
|
}")
|
|
|
|
(define test-source-hash
|
|
"")
|
|
|
|
(define test-requirements
|
|
"# A comment
|
|
# A comment after a space
|
|
bar
|
|
baz > 13.37")
|
|
|
|
(test-begin "pypi")
|
|
|
|
(test-assert "pypi->guix-package"
|
|
;; Replace network resources with sample data.
|
|
(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")
|
|
(with-output-to-file "foo-1.0.0/requirements.txt"
|
|
(lambda ()
|
|
(display test-requirements)))
|
|
(system* "tar" "czvf" file-name "foo-1.0.0/")
|
|
(delete-file-recursively "foo-1.0.0")
|
|
(set! test-source-hash
|
|
(call-with-input-file file-name port-sha256))))
|
|
(_ (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)
|
|
('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 'lgpl2.0))
|
|
(string=? (bytevector->nix-base32-string
|
|
test-source-hash)
|
|
hash))
|
|
(x
|
|
(pk 'fail x #f)))))
|
|
|
|
(test-end "pypi")
|