summaryrefslogtreecommitdiff
path: root/test/automated/package-test.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-04-12 01:10:35 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-04-12 01:12:33 +0100
commit7cae5c3cb6bcbee49e56c8d607d64071f9196952 (patch)
tree79f2eb9a4e4017f71683b68265525a9469024300 /test/automated/package-test.el
parentccade56fbee75dfebc6e1826738550a1c131d933 (diff)
downloademacs-7cae5c3cb6bcbee49e56c8d607d64071f9196952.tar.gz
* test/automated/package-test.el: Test async functionality
(package-test-update-archives-async): New test
Diffstat (limited to 'test/automated/package-test.el')
-rw-r--r--test/automated/package-test.el30
1 files changed, 29 insertions, 1 deletions
diff --git a/test/automated/package-test.el b/test/automated/package-test.el
index 5fae216ef7d..b343ed7285d 100644
--- a/test/automated/package-test.el
+++ b/test/automated/package-test.el
@@ -103,6 +103,7 @@
(cl-defmacro with-package-test ((&optional &key file
basedir
install
+ location
update-news
upload-base)
&rest body)
@@ -112,7 +113,7 @@
(process-environment (cons (format "HOME=%s" package-test-user-dir)
process-environment))
(package-user-dir package-test-user-dir)
- (package-archives `(("gnu" . ,package-test-data-dir)))
+ (package-archives `(("gnu" . ,(or ,location package-test-data-dir))))
(default-directory package-test-file-dir)
abbreviated-home-dir
package--initialized
@@ -336,6 +337,33 @@ Must called from within a `tar-mode' buffer."
(package-menu-refresh)
(should (package-installed-p 'simple-single '(1 4)))))))
+(ert-deftest package-test-update-archives-async ()
+ "Test updating package archives asynchronously."
+ (skip-unless (executable-find "python2"))
+ (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
+ (list-packages)
+ (should package--downloads-in-progress)
+ (should mode-line-process)
+ (should-not (string= (format-mode-line mode-line-process) ""))
+ (should-not
+ (with-timeout (10 'timeout)
+ (while package--downloads-in-progress
+ (accept-process-output nil 1))
+ nil))
+ (goto-char (point-min))
+ (should
+ (search-forward-regexp "^ +simple-single" nil t)))
+ (kill-process process)))))
+
(ert-deftest package-test-describe-package ()
"Test displaying help for a package."