diff options
author | Glenn Morris <rgm@gnu.org> | 2016-06-07 21:25:20 -0400 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2016-06-07 21:25:20 -0400 |
commit | 3a28d64e275ca6860f81016b04a2024d9c66da1f (patch) | |
tree | b0d3282c3452e15c64c89d5479c83fa095645c50 /test/lisp/emacs-lisp | |
parent | f4ef1a1fea15aa58fbb5e7a59bff260720658e49 (diff) | |
download | emacs-3a28d64e275ca6860f81016b04a2024d9c66da1f.tar.gz emacs-3a28d64e275ca6860f81016b04a2024d9c66da1f.tar.bz2 emacs-3a28d64e275ca6860f81016b04a2024d9c66da1f.zip |
Do not hard-code port for package test server. (Bug#23708)
* test/lisp/emacs-lisp/package-resources/package-test-server.py:
Do not hard-code port.
* test/lisp/emacs-lisp/package-tests.el (package-test-update-archives-async):
Update for the above change.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/package-test-server.py | 2 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-tests.el | 36 |
2 files changed, 25 insertions, 13 deletions
diff --git a/test/lisp/emacs-lisp/package-resources/package-test-server.py b/test/lisp/emacs-lisp/package-resources/package-test-server.py index 35ca820f31f..1acd9f744b9 100644 --- a/test/lisp/emacs-lisp/package-resources/package-test-server.py +++ b/test/lisp/emacs-lisp/package-resources/package-test-server.py @@ -10,7 +10,7 @@ Protocol = "HTTP/1.0" if sys.argv[1:]: port = int(sys.argv[1]) else: - port = 8000 + port = 0 server_address = ('127.0.0.1', port) HandlerClass.protocol_version = Protocol diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index c7a5cc7af22..0a446fde086 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -372,16 +372,28 @@ Must called from within a `tar-mode' buffer." (skip-unless (executable-find "python2")) ;; For some reason this test doesn't work reliably on hydra.nixos.org. (skip-unless (not (getenv "NIX_STORE"))) - (with-package-test (:basedir - package-test-data-dir - :location "http://0.0.0.0:8000/") - (let* ((package-menu-async t) - (process (start-process - "package-server" "package-server-buffer" - (executable-find "python2") - (expand-file-name "package-test-server.py")))) - (unwind-protect - (progn + (let* ((package-menu-async t) + (default-directory package-test-data-dir) + (process (start-process + "package-server" "package-server-buffer" + (executable-find "python2") + "package-test-server.py")) + port) + (unwind-protect + (progn + (with-current-buffer "package-server-buffer" + (should + (with-timeout (10 nil) + (while (not port) + (accept-process-output nil 1) + (goto-char (point-min)) + (if (re-search-forward "Serving HTTP on .* port \\([0-9]+\\) " + nil t) + (setq port (match-string 1)))) + port))) + (with-package-test (:basedir + package-test-data-dir + :location (format "http://0.0.0.0:%s/" port)) (list-packages) (should package--downloads-in-progress) (should mode-line-process) @@ -395,8 +407,8 @@ Must called from within a `tar-mode' buffer." (skip-unless (process-live-p process)) (goto-char (point-min)) (should - (search-forward-regexp "^ +simple-single" nil t))) - (if (process-live-p process) (kill-process process)))))) + (search-forward-regexp "^ +simple-single" nil t)))) + (if (process-live-p process) (kill-process process))))) (ert-deftest package-test-describe-package () "Test displaying help for a package." |