3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00

import: texlive: Avoid uses of '@@' in tests.

* guix/import/texlive.scm (fetch-sxml, sxml->package): Export.
* tests/texlive.scm <top level>: Call '%http-server-port'.
("fetch-sxml: returns SXML for valid XML"): Use 'with-http-server' and
set 'current-http-proxy' instead of using 'mock'.
("sxml->package"): Remove use of '@@'.
This commit is contained in:
Ludovic Courtès 2020-01-17 13:50:53 +01:00
parent 282f91790a
commit 6f918d69b4
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 13 additions and 6 deletions

View file

@ -38,7 +38,10 @@
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (guix build-system texlive) #:use-module (guix build-system texlive)
#:export (texlive->guix-package)) #:export (texlive->guix-package
fetch-sxml
sxml->package))
;;; Commentary: ;;; Commentary:
;;; ;;;

View file

@ -20,10 +20,12 @@
#:use-module (gnu packages tex) #:use-module (gnu packages tex)
#:use-module (guix import texlive) #:use-module (guix import texlive)
#:use-module (guix tests) #:use-module (guix tests)
#:use-module (guix tests http)
#:use-module (guix build utils) #:use-module (guix build utils)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-64) #:use-module (srfi srfi-64)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (web client)
#:use-module (ice-9 match)) #:use-module (ice-9 match))
(test-begin "texlive") (test-begin "texlive")
@ -67,12 +69,14 @@
(keyval (@ (value "tests") (key "topic"))) (keyval (@ (value "tests") (key "topic")))
"\n null\n"))) "\n null\n")))
;; Avoid collisions with other tests.
(%http-server-port 10200)
(test-equal "fetch-sxml: returns SXML for valid XML" (test-equal "fetch-sxml: returns SXML for valid XML"
sxml sxml
(mock ((guix http-client) http-fetch (with-http-server `((200 ,xml))
(lambda (url) (parameterize ((current-http-proxy (%local-url)))
xml)) (fetch-sxml "foo"))))
((@@ (guix import texlive) fetch-sxml) "foo")))
;; TODO: ;; TODO:
(test-assert "sxml->package" (test-assert "sxml->package"
@ -86,7 +90,7 @@
(with-output-to-file (string-append directory "/foo") (with-output-to-file (string-append directory "/foo")
(lambda () (lambda ()
(display "source"))))) (display "source")))))
(let ((result ((@@ (guix import texlive) sxml->package) sxml))) (let ((result (sxml->package sxml)))
(match result (match result
(('package (('package
('name "texlive-latex-foo") ('name "texlive-latex-foo")