~ruther/guix-local

53bf9fba0c9542a46702bb30251f5796da371e64 — Ludovic Courtès 3 years ago f69d14d
tests: Ensure 'elpa' test does not access the network.

Previously it would try to access the real elpa.gnu.org.  This would
succeed when network is available because "taxy-magit-section" is an
existing package.

* guix/import/elpa.scm (elpa-repository)
(package-from-elpa-repository?): Recognize 'gnu/http.
* tests/elpa.scm ("package-latest-release"): Use 'http' instead of
'https'.  Change "taxy-magit-section" to "fake-taxy-magit-section".
2 files changed, 20 insertions(+), 17 deletions(-)

M guix/import/elpa.scm
M tests/elpa.scm
M guix/import/elpa.scm => guix/import/elpa.scm +4 -2
@@ 461,13 461,15 @@ type '<elpa-package>'."
                      (and uri
                           (cond
                            ((string=? (uri-host uri) "elpa.gnu.org")
                             'gnu)
                             (if (eq? (uri-scheme uri) 'http)
                                 'gnu/http        ;for testing
                                 'gnu))
                            ((string=? (uri-host uri) "elpa.nongnu.org")
                             'nongnu)
                            (else #f))))))))

(define (package-from-elpa-repository? package)
  (member (elpa-repository package) '(gnu nongnu)))
  (member (elpa-repository package) '(gnu gnu/http nongnu)))

(define %elpa-updater
  ;; The ELPA updater.  We restrict it to packages hosted on elpa.gnu.org

M tests/elpa.scm => tests/elpa.scm +16 -15
@@ 43,17 43,17 @@
            [(11 88 6)
             nil "Integrated environment for *TeX*" tar
             ((:url . "http://www.gnu.org/software/auctex/"))])
    (taxy-magit-section .
		        [(0 12 2)
		         ((emacs
			   (26 3))
		          (magit-section
			   (3 2 1))
		          (taxy
			   (0 10)))
		         "View Taxy structs in a Magit Section buffer" tar
		         ((:url . "https://github.com/alphapapa/taxy.el")
		          (:keywords "lisp"))])))
    (fake-taxy-magit-section .
		             [(0 12 2)
		              ((emacs
			        (26 3))
		               (magit-section
			        (3 2 1))
		               (taxy
			        (0 10)))
		              "View Taxy structs in a Magit Section buffer" tar
		              ((:url . "https://github.com/alphapapa/taxy.el")
		               (:keywords "lisp"))])))


(test-begin "elpa")


@@ 88,8 88,8 @@
  (eval-test-with-elpa "auctex"))

(test-equal "package-latest-release"
  (list '("https://elpa.gnu.org/packages/taxy-magit-section-0.12.2.tar")
        '("https://elpa.gnu.org/packages/taxy-magit-section-0.12.2.tar.sig")
  (list '("http://elpa.gnu.org/packages/fake-taxy-magit-section-0.12.2.tar")
        '("http://elpa.gnu.org/packages/fake-taxy-magit-section-0.12.2.tar.sig")
        (list (upstream-input
               (name "magit-section")
               (downstream-name "emacs-magit-section")


@@ 105,12 105,13 @@
  (with-http-server `((200 ,(object->string elpa-mock-archive)))
    (parameterize ((current-http-proxy (%local-url)))
      (define source
        ;; Note: Use 'http' URLs to the proxy is used.
        (package-latest-release
         (dummy-package "emacs-taxy-magit-section"
         (dummy-package "emacs-fake-taxy-magit-section"
                        (version "0.0.0")
                        (source (dummy-origin
                                 (method url-fetch)
                                 (uri "https://elpa.gnu.org/xyz"))))
                                 (uri "http://elpa.gnu.org/xyz"))))
         (list %elpa-updater)))

      (list (upstream-source-urls source)