summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-01-17 13:50:53 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-17 14:22:08 +0100
commit6f918d69b4824226c877c0ca6385360a1dd38bbd (patch)
tree11ea00201d653ab2269c86fbc1ca943d3bfb6341
parent282f91790a5bbd0d9b3223c4bfd45b66e418c200 (diff)
downloadpatches-6f918d69b4824226c877c0ca6385360a1dd38bbd.tar
patches-6f918d69b4824226c877c0ca6385360a1dd38bbd.tar.gz
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 '@@'.
-rw-r--r--guix/import/texlive.scm5
-rw-r--r--tests/texlive.scm14
2 files changed, 13 insertions, 6 deletions
diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm
index d528aace9a..a84683ef6f 100644
--- a/guix/import/texlive.scm
+++ b/guix/import/texlive.scm
@@ -38,7 +38,10 @@
#:use-module (guix packages)
#:use-module (gnu packages)
#:use-module (guix build-system texlive)
- #:export (texlive->guix-package))
+ #:export (texlive->guix-package
+
+ fetch-sxml
+ sxml->package))
;;; Commentary:
;;;
diff --git a/tests/texlive.scm b/tests/texlive.scm
index e28eda175c..f7e5515c4c 100644
--- a/tests/texlive.scm
+++ b/tests/texlive.scm
@@ -20,10 +20,12 @@
#:use-module (gnu packages tex)
#:use-module (guix import texlive)
#:use-module (guix tests)
+ #:use-module (guix tests http)
#:use-module (guix build utils)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-64)
#:use-module (srfi srfi-26)
+ #:use-module (web client)
#:use-module (ice-9 match))
(test-begin "texlive")
@@ -67,12 +69,14 @@
(keyval (@ (value "tests") (key "topic")))
"\n null\n")))
+;; Avoid collisions with other tests.
+(%http-server-port 10200)
+
(test-equal "fetch-sxml: returns SXML for valid XML"
sxml
- (mock ((guix http-client) http-fetch
- (lambda (url)
- xml))
- ((@@ (guix import texlive) fetch-sxml) "foo")))
+ (with-http-server `((200 ,xml))
+ (parameterize ((current-http-proxy (%local-url)))
+ (fetch-sxml "foo"))))
;; TODO:
(test-assert "sxml->package"
@@ -86,7 +90,7 @@
(with-output-to-file (string-append directory "/foo")
(lambda ()
(display "source")))))
- (let ((result ((@@ (guix import texlive) sxml->package) sxml)))
+ (let ((result (sxml->package sxml)))
(match result
(('package
('name "texlive-latex-foo")