tests: Assume ‘git’ is always available.

* tests/channels.scm (gpg+git-available?): Check for ‘gpg-command’
only.
Remove all ‘test-skip’ statements.
* tests/derivations.scm: Likewise.
* tests/git-authenticate.scm: Likewise.
* tests/git.scm: Likewise.
* tests/import-git.scm: Likewise.
This commit is contained in:
Ludovic Courtès 2023-09-11 16:04:31 +02:00
parent 13b0cf85eb
commit ba21eeb565
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
5 changed files with 2 additions and 40 deletions

View File

@ -50,7 +50,7 @@
#:use-module (ice-9 match)) #:use-module (ice-9 match))
(define (gpg+git-available?) (define (gpg+git-available?)
(and (which (git-command)) (and #t ;'git' is always available
(which (gpg-command)) (which (gpgconf-command)))) (which (gpg-command)) (which (gpgconf-command))))
(define commit-id-string (define commit-id-string
@ -196,7 +196,6 @@
"abc1234"))) "abc1234")))
instances))))))) instances)))))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-channel-instances #:validate-pull" (test-equal "latest-channel-instances #:validate-pull"
'descendant 'descendant
@ -306,7 +305,6 @@
(depends? drv3 (depends? drv3
(list drv2 drv0) (list)))))))) (list drv2 drv0) (list))))))))
(unless (which (git-command)) (test-skip 1))
(test-equal "channel-news, no news" (test-equal "channel-news, no news"
'() '()
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -318,7 +316,6 @@
(latest (reference-name->oid repository "HEAD"))) (latest (reference-name->oid repository "HEAD")))
(channel-news-for-commit channel (oid->string latest)))))) (channel-news-for-commit channel (oid->string latest))))))
(unless (which (git-command)) (test-skip 1))
(test-assert "channel-news, one entry" (test-assert "channel-news, one entry"
(with-temporary-git-repository directory (with-temporary-git-repository directory
`((add ".guix-channel" `((add ".guix-channel"
@ -406,7 +403,6 @@
(channel-news-for-commit channel commit5 commit1)) (channel-news-for-commit channel commit5 commit1))
'(#f "tag-for-first-news-entry"))))))) '(#f "tag-for-first-news-entry")))))))
(unless (which (git-command)) (test-skip 1))
(test-assert "channel-news, annotated tag" (test-assert "channel-news, annotated tag"
(with-temporary-git-repository directory (with-temporary-git-repository directory
`((add ".guix-channel" `((add ".guix-channel"
@ -453,7 +449,6 @@
(channel-news-for-commit channel commit2)) (channel-news-for-commit channel commit2))
(list commit1))))))) (list commit1)))))))
(unless (which (git-command)) (test-skip 1))
(test-assert "latest-channel-instances, missing introduction for 'guix'" (test-assert "latest-channel-instances, missing introduction for 'guix'"
(with-temporary-git-repository directory (with-temporary-git-repository directory
'((add "a.txt" "A") '((add "a.txt" "A")

View File

@ -29,7 +29,7 @@
#:use-module (guix tests git) #:use-module (guix tests git)
#:use-module (guix tests http) #:use-module (guix tests http)
#:use-module ((guix packages) #:select (package-derivation base32)) #:use-module ((guix packages) #:select (package-derivation base32))
#:use-module ((guix build utils) #:select (executable-file? which)) #:use-module ((guix build utils) #:select (executable-file?))
#:use-module ((guix hash) #:select (file-hash*)) #:use-module ((guix hash) #:select (file-hash*))
#:use-module ((git oid) #:select (oid->string)) #:use-module ((git oid) #:select (oid->string))
#:use-module ((git reference) #:select (reference-name->oid)) #:use-module ((git reference) #:select (reference-name->oid))
@ -295,8 +295,6 @@
get-string-all) get-string-all)
text)))))) text))))))
;; 'with-temporary-git-repository' relies on the 'git' command.
(unless (which (git-command)) (test-skip 1))
(test-equal "'git-download' built-in builder" (test-equal "'git-download' built-in builder"
`(("/a.txt" . "AAA") `(("/a.txt" . "AAA")
("/b.scm" . "#t")) ("/b.scm" . "#t"))
@ -325,7 +323,6 @@
(build-derivations %store (list drv)) (build-derivations %store (list drv))
(directory-contents (derivation->output-path drv) get-string-all))))) (directory-contents (derivation->output-path drv) get-string-all)))))
(unless (which (git-command)) (test-skip 1))
(test-assert "'git-download' built-in builder, invalid hash" (test-assert "'git-download' built-in builder, invalid hash"
(with-temporary-git-repository directory (with-temporary-git-repository directory
`((add "a.txt" "AAA") `((add "a.txt" "AAA")
@ -349,7 +346,6 @@
(build-derivations %store (list drv)) (build-derivations %store (list drv))
#f)))) #f))))
(unless (which (git-command)) (test-skip 1))
(test-assert "'git-download' built-in builder, invalid commit" (test-assert "'git-download' built-in builder, invalid commit"
(with-temporary-git-repository directory (with-temporary-git-repository directory
`((add "a.txt" "AAA") `((add "a.txt" "AAA")

View File

@ -44,7 +44,6 @@
(test-begin "git-authenticate") (test-begin "git-authenticate")
(unless (which (git-command)) (test-skip 1))
(test-assert "unsigned commits" (test-assert "unsigned commits"
(with-temporary-git-repository directory (with-temporary-git-repository directory
'((add "a.txt" "A") '((add "a.txt" "A")

View File

@ -21,7 +21,6 @@
#:use-module (git) #:use-module (git)
#:use-module (guix git) #:use-module (guix git)
#:use-module (guix tests git) #:use-module (guix tests git)
#:use-module (guix build utils)
#:use-module ((guix utils) #:select (call-with-temporary-directory)) #:use-module ((guix utils) #:select (call-with-temporary-directory))
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-64) #:use-module (srfi srfi-64)
@ -33,8 +32,6 @@
(test-begin "git") (test-begin "git")
;; 'with-temporary-git-repository' relies on the 'git' command.
(unless (which (git-command)) (test-skip 1))
(test-assert "commit-difference, linear history" (test-assert "commit-difference, linear history"
(with-temporary-git-repository directory (with-temporary-git-repository directory
'((add "a.txt" "A") '((add "a.txt" "A")
@ -61,7 +58,6 @@
;; empty list. ;; empty list.
(null? (commit-difference commit1 commit4))))))) (null? (commit-difference commit1 commit4)))))))
(unless (which (git-command)) (test-skip 1))
(test-assert "commit-difference, fork" (test-assert "commit-difference, fork"
(with-temporary-git-repository directory (with-temporary-git-repository directory
'((add "a.txt" "A") '((add "a.txt" "A")
@ -101,7 +97,6 @@
(lset= eq? (commit-difference master4 master2) (lset= eq? (commit-difference master4 master2)
(list master4 merge master3 devel1 devel2))))))) (list master4 merge master3 devel1 devel2)))))))
(unless (which (git-command)) (test-skip 1))
(test-assert "commit-difference, excluded commits" (test-assert "commit-difference, excluded commits"
(with-temporary-git-repository directory (with-temporary-git-repository directory
'((add "a.txt" "A") '((add "a.txt" "A")
@ -126,7 +121,6 @@
(list commit4)) (list commit4))
(null? (commit-difference commit4 commit1 (list commit5)))))))) (null? (commit-difference commit4 commit1 (list commit5))))))))
(unless (which (git-command)) (test-skip 1))
(test-equal "commit-relation" (test-equal "commit-relation"
'(self ;master3 master3 '(self ;master3 master3
ancestor ;master1 master3 ancestor ;master1 master3
@ -166,7 +160,6 @@
(commit-relation master1 merge) (commit-relation master1 merge)
(commit-relation merge master1)))))) (commit-relation merge master1))))))
(unless (which (git-command)) (test-skip 1))
(test-equal "commit-descendant?" (test-equal "commit-descendant?"
'((master3 master3 => #t) '((master3 master3 => #t)
(master1 master3 => #f) (master1 master3 => #f)
@ -216,7 +209,6 @@
(master1 merge) (master1 merge)
(merge master1))))))) (merge master1)))))))
(unless (which (git-command)) (test-skip 1))
(test-equal "remote-refs" (test-equal "remote-refs"
'("refs/heads/develop" "refs/heads/master" '("refs/heads/develop" "refs/heads/master"
"refs/tags/v1.0" "refs/tags/v1.1") "refs/tags/v1.0" "refs/tags/v1.1")
@ -231,7 +223,6 @@
(tag "v1.1" "release-1.1")) (tag "v1.1" "release-1.1"))
(remote-refs directory))) (remote-refs directory)))
(unless (which (git-command)) (test-skip 1))
(test-equal "remote-refs: only tags" (test-equal "remote-refs: only tags"
'("refs/tags/v1.0" "refs/tags/v1.1") '("refs/tags/v1.0" "refs/tags/v1.1")
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -243,7 +234,6 @@
(tag "v1.1" "Release 1.1")) (tag "v1.1" "Release 1.1"))
(remote-refs directory #:tags? #t))) (remote-refs directory #:tags? #t)))
(unless (which (git-command)) (test-skip 1))
(test-assert "update-cached-checkout, tag" (test-assert "update-cached-checkout, tag"
(call-with-temporary-directory (call-with-temporary-directory
(lambda (cache) (lambda (cache)

View File

@ -24,7 +24,6 @@
#:use-module (guix import git) #:use-module (guix import git)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix tests git) #:use-module (guix tests git)
#: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))
@ -46,7 +45,6 @@
(base32 (base32
"0000000000000000000000000000000000000000000000000000")))))) "0000000000000000000000000000000000000000000000000000"))))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: no custom prefix, suffix, and delimiter" (test-equal "latest-git-tag-version: no custom prefix, suffix, and delimiter"
"1.0.1" "1.0.1"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -56,7 +54,6 @@
(let ((package (make-package directory "1.0.0"))) (let ((package (make-package directory "1.0.0")))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: custom prefix, no suffix and delimiter" (test-equal "latest-git-tag-version: custom prefix, no suffix and delimiter"
"1.0.1" "1.0.1"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -67,7 +64,6 @@
'((release-tag-prefix . "prefix-"))))) '((release-tag-prefix . "prefix-")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: custom suffix, no prefix and delimiter" (test-equal "latest-git-tag-version: custom suffix, no prefix and delimiter"
"1.0.1" "1.0.1"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -78,7 +74,6 @@
'((release-tag-suffix . "-suffix-[0-9]*"))))) '((release-tag-suffix . "-suffix-[0-9]*")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: custom delimiter, no prefix and suffix" (test-equal "latest-git-tag-version: custom delimiter, no prefix and suffix"
"2021.09.07" "2021.09.07"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -89,7 +84,6 @@
'((release-tag-version-delimiter . "-"))))) '((release-tag-version-delimiter . "-")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: empty delimiter, no prefix and suffix" (test-equal "latest-git-tag-version: empty delimiter, no prefix and suffix"
"20210907" "20210907"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -100,7 +94,6 @@
'((release-tag-version-delimiter . ""))))) '((release-tag-version-delimiter . "")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: custom prefix and suffix, no delimiter" (test-equal "latest-git-tag-version: custom prefix and suffix, no delimiter"
"2.0.0" "2.0.0"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -112,7 +105,6 @@
(release-tag-suffix . "suffix-[0-9]"))))) (release-tag-suffix . "suffix-[0-9]")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: custom prefix, suffix, and delimiter" (test-equal "latest-git-tag-version: custom prefix, suffix, and delimiter"
"2.0.0" "2.0.0"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -125,7 +117,6 @@
(release-tag-version-delimiter . "_"))))) (release-tag-version-delimiter . "_")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: only pre-releases available" (test-equal "latest-git-tag-version: only pre-releases available"
#f #f
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -135,7 +126,6 @@
(let ((package (make-package directory "1.0.0"))) (let ((package (make-package directory "1.0.0")))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: accept pre-releases" (test-equal "latest-git-tag-version: accept pre-releases"
"2.0.0-rc1" "2.0.0-rc1"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -146,7 +136,6 @@
'((accept-pre-releases? . #t))))) '((accept-pre-releases? . #t)))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: accept pre-releases, and custom prefix" (test-equal "latest-git-tag-version: accept pre-releases, and custom prefix"
"2.0.0-rc1" "2.0.0-rc1"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -158,7 +147,6 @@
(release-tag-prefix . "version-"))))) (release-tag-prefix . "version-")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: accept pre-releases, and custom suffix" (test-equal "latest-git-tag-version: accept pre-releases, and custom suffix"
"2.0.0-rc1" "2.0.0-rc1"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -170,7 +158,6 @@
(release-tag-suffix . "-suffix"))))) (release-tag-suffix . "-suffix")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: accept pre-releases, delimiter conflicts with pre-release part" (test-equal "latest-git-tag-version: accept pre-releases, delimiter conflicts with pre-release part"
"2.0.0_alpha" "2.0.0_alpha"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -182,7 +169,6 @@
(release-tag-version-delimiter . "_"))))) (release-tag-version-delimiter . "_")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: accept pre-releases, and custom suffix and prefix" (test-equal "latest-git-tag-version: accept pre-releases, and custom suffix and prefix"
"2.0.0-alpha" "2.0.0-alpha"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -195,7 +181,6 @@
(release-tag-suffix . "-suffix"))))) (release-tag-suffix . "-suffix")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: accept pre-releases, and custom suffix, prefix, and delimiter" (test-equal "latest-git-tag-version: accept pre-releases, and custom suffix, prefix, and delimiter"
"2.0.0-alpha" "2.0.0-alpha"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -209,7 +194,6 @@
(release-tag-version-delimiter . "-"))))) (release-tag-version-delimiter . "-")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: accept pre-releases, no delimiter, and custom suffix, prefix" (test-equal "latest-git-tag-version: accept pre-releases, no delimiter, and custom suffix, prefix"
"2alpha" "2alpha"
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -223,7 +207,6 @@
(release-tag-version-delimiter . ""))))) (release-tag-version-delimiter . "")))))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: no tags found" (test-equal "latest-git-tag-version: no tags found"
#f #f
(with-temporary-git-repository directory (with-temporary-git-repository directory
@ -232,7 +215,6 @@
(let ((package (make-package directory "1.0.0"))) (let ((package (make-package directory "1.0.0")))
(latest-git-tag-version package)))) (latest-git-tag-version package))))
(unless (which (git-command)) (test-skip 1))
(test-equal "latest-git-tag-version: no valid tags found" (test-equal "latest-git-tag-version: no valid tags found"
#f #f
(with-temporary-git-repository directory (with-temporary-git-repository directory