tests: Allow opam test to run without networking.

Fixes a regression introduced in
fc29c80b96, where, since
'get-opam-repository' was no longer mocked, the test would try to access
the actual OPAM repository through a call to 'http-fetch/cached'; this
would lead to a test failure when networking is unavailable.

* tests/opam.scm ("opam->guix-package"): Mock 'get-opam-repository'
again.
This commit is contained in:
Ludovic Courtès 2021-09-18 18:24:05 +02:00
parent 511dc6877e
commit 358ad74f41
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 46 additions and 44 deletions

View File

@ -71,6 +71,8 @@ url {
(test-begin "opam")
(test-assert "opam->guix-package"
(mock ((guix import opam) get-opam-repository
(const test-repo))
(mock ((guix import utils) url-fetch
(lambda (url file-name)
(match url
@ -114,7 +116,7 @@ url {
test-source-hash)
hash))
(x
(pk 'fail x #f)))))
(pk 'fail x #f))))))
;; Test the opam file parser
;; We fold over some test cases. Each case is a pair of the string to parse and the