GNU bug report logs -
#62202
[PATCH 0/21] Juliahub import script.
Previous Next
Full log
View this message in rfc822 format
Hi,
As part of this v4, I would recommend merging patches 2, 3, and 6, such
that there’s a single self-contained patch adding ‘guix import
juliahub’. (That’s what we usually do and I find it clearer because we
immediately see what goes together.)
Nicolas Graves <ngraves <at> ngraves.fr> skribis:
> * tests/juliahub.scm : Add unit tests juliahub-redirect,
> julia-general-registry-parsing, juliahub-fetch.
Just “New file.”
Some of the other files lack a commit log; we can add it for you, but
it’d be great if you could do it upfront.
> ---
> tests/juliahub.scm | 185 +++++++++++++++++++++++++++++++++++++++++++++
Please add it to ‘Makefile.am’.
[...]
> +(define (mock-http-fetch testcase)
> + (lambda (url . rest)
> + (let ((body (assoc-ref testcase url)))
> + (if body
> + (open-input-string body)
> + (error "mocked http-fetch Unexpected URL: " url)))))
> +
> +(define (mock-http-get testcase)
> + (lambda (url . rest)
> + (let ((body (assoc-ref testcase url))
> + (response-header
> + (build-response
> + #:version '(1 . 1)
I strongly encourage using ‘with-http-server’ using the same strategy
that’s used in ‘tests/pypi.scm’ and others instead of mocking. (‘mock’
is very sensitive to inlining, plus you sorta have to make assumptions
about the code path to be able to mock the right things.)
> +(test-equal "juliahub-fetch"
> + #t
> + (mock ((web client) http-get
> + (mock-http-get fixtures-juliahub-check-test))
> + (mock ((guix http-client) http-fetch
> + (mock-http-fetch fixtures-juliahub-check-test))
> + (mock ((guix import utils) git->origin mock-git->origin)
> + ((@@ (guix import juliahub) juliahub-package?)
> + ((@@ (guix import juliahub) juliahub-fetch) "MyPackage"))))))
Checking for ‘juliahub-package?’ doesn’t tell us much; what about
checking the whole package, similar to what is done in other importer
tests?
Thanks,
Ludo’.
This bug report was last modified 62 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.