Commit 3a28d64e authored by Glenn Morris's avatar Glenn Morris
Browse files

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.
parent f4ef1a1f
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
if sys.argv[1:]: if sys.argv[1:]:
port = int(sys.argv[1]) port = int(sys.argv[1])
else: else:
port = 8000 port = 0
server_address = ('127.0.0.1', port) server_address = ('127.0.0.1', port)
HandlerClass.protocol_version = Protocol HandlerClass.protocol_version = Protocol
......
...@@ -372,16 +372,28 @@ Must called from within a `tar-mode' buffer." ...@@ -372,16 +372,28 @@ Must called from within a `tar-mode' buffer."
(skip-unless (executable-find "python2")) (skip-unless (executable-find "python2"))
;; For some reason this test doesn't work reliably on hydra.nixos.org. ;; For some reason this test doesn't work reliably on hydra.nixos.org.
(skip-unless (not (getenv "NIX_STORE"))) (skip-unless (not (getenv "NIX_STORE")))
(with-package-test (:basedir (let* ((package-menu-async t)
package-test-data-dir (default-directory package-test-data-dir)
:location "http://0.0.0.0:8000/") (process (start-process
(let* ((package-menu-async t) "package-server" "package-server-buffer"
(process (start-process (executable-find "python2")
"package-server" "package-server-buffer" "package-test-server.py"))
(executable-find "python2") port)
(expand-file-name "package-test-server.py")))) (unwind-protect
(unwind-protect (progn
(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) (list-packages)
(should package--downloads-in-progress) (should package--downloads-in-progress)
(should mode-line-process) (should mode-line-process)
...@@ -395,8 +407,8 @@ Must called from within a `tar-mode' buffer." ...@@ -395,8 +407,8 @@ Must called from within a `tar-mode' buffer."
(skip-unless (process-live-p process)) (skip-unless (process-live-p process))
(goto-char (point-min)) (goto-char (point-min))
(should (should
(search-forward-regexp "^ +simple-single" nil t))) (search-forward-regexp "^ +simple-single" nil t))))
(if (process-live-p process) (kill-process process)))))) (if (process-live-p process) (kill-process process)))))
(ert-deftest package-test-describe-package () (ert-deftest package-test-describe-package ()
"Test displaying help for a package." "Test displaying help for a package."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment