mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 02:31:03 -08:00
Fix package-vc-tests
* lisp/emacs-lisp/package-vc.el (package-vc--make): Use same format for buffer as `package-vc--build-documentation'. * test/lisp/emacs-lisp/package-vc-tests.el (message-auto-save-directory): Silence byte compiler. (package-vc-with-tests-environment): Initialize package archives after setting a temporary `package-user-dir'. Set up `package-gnupghome-dir'. Remove `default-directory' binding. (package-vc-tests-environment-tear-down): Fix argument order in `package-vc-tests-log-buffer-name' call. (package-vc-tests-with-installed): Rename from `package-vc-with-installed-tests'. (package-vc-test-deftest): Use `package-vc-tests-with-installed'. (prepare-patch): Bind `message-auto-save-directory' to `package-vc-tests-dir'. * test/lisp/package-vc-tests.el: Rename to test/lisp/emacs-lisp/package-vc-tests.el * test/lisp/package-vc-resources/Makefile.in: Rename to test/lisp/emacs-lisp/package-vc-resources/Makefile.in * test/lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in * test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in * test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in * test/lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in * test/lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in * test/lisp/package-vc-resources/test-package-SUFFIX.texi.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX.texi.in
This commit is contained in:
parent
70d24d0dd5
commit
777622682f
9 changed files with 23 additions and 22 deletions
|
|
@ -407,7 +407,7 @@ prepared."
|
|||
(let ((default-directory (package-vc--checkout-dir pkg-desc))
|
||||
(target (plist-get pkg-spec :make))
|
||||
(cmd (plist-get pkg-spec :shell-command))
|
||||
(buf (format " *package-vc make %s*" (package-desc-name pkg-desc)))
|
||||
(buf (format " *package-vc make: %s*" (package-desc-name pkg-desc)))
|
||||
(makexe (or package-vc-make-program
|
||||
(seq-find #'executable-find '("gmake" "make")))))
|
||||
(when (or cmd target)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@
|
|||
(require 'ert-x)
|
||||
(require 'ert)
|
||||
|
||||
;; Silence byte-compiler
|
||||
(defvar message-auto-save-directory)
|
||||
|
||||
(defvar package-vc-tests-preserve-artefacts nil
|
||||
"When non-nil preserve temporary files and buffers produced by tests.
|
||||
Each test produces a new temporary directory for each package under
|
||||
|
|
@ -391,22 +394,24 @@ names."
|
|||
;; in directory package-vc-resources. Before executing body make sure
|
||||
;; that:
|
||||
;;
|
||||
;; - `package' has been initialised, and there are no
|
||||
;; `package-archives' defined
|
||||
(let* ((package-archives (unless package--initialized
|
||||
(let (package-archives)
|
||||
(package-initialize)
|
||||
(package-vc--archives-initialize))
|
||||
nil))
|
||||
;; - create a temporary location for packages and test files
|
||||
(package-vc-tests-dir
|
||||
(let* ((package-vc-tests-dir
|
||||
(expand-file-name
|
||||
(make-temp-file "package-vc-tests-"
|
||||
t
|
||||
(format-time-string "-%Y%m%d.%H%M%S.%3N"))))
|
||||
;; - packages are installed into a test directory
|
||||
;; - packages are installed into test directory
|
||||
(package-user-dir (expand-file-name "elpa"
|
||||
package-vc-tests-dir))
|
||||
;; - keyring is saved in test directory
|
||||
(package-gnupghome-dir (expand-file-name "gnupg"
|
||||
package-user-dir))
|
||||
;; - `package' has been initialised, and there are no
|
||||
;; `package-archives' defined
|
||||
(package-archives (unless package--initialized
|
||||
(let (package-archives)
|
||||
(package-initialize)
|
||||
(package-vc--archives-initialize))
|
||||
nil))
|
||||
;; - define test packages, their checkout locations, lisp
|
||||
;; directories, and install functions
|
||||
(package-vc-tests-packages (package-vc-tests-packages))
|
||||
|
|
@ -476,12 +481,7 @@ names."
|
|||
;; - don't register projects
|
||||
(package-vc-register-as-project nil)
|
||||
;; - allow build commands
|
||||
(package-vc-allow-build-commands t)
|
||||
;; - FIXME: something sets `default-directory' to last
|
||||
;; checkout directory after `package-vc-checkout', which
|
||||
;; causes problems when this function deletes the temporary
|
||||
;; directory after body execution.
|
||||
(default-directory package-vc-tests-dir))
|
||||
(package-vc-allow-build-commands t))
|
||||
(funcall function)))
|
||||
|
||||
(defun package-vc-tests-environment-tear-down (pkg)
|
||||
|
|
@ -524,8 +524,8 @@ when PKG matches `package-vc-tests-preserve-artefacts'."
|
|||
(delq nil
|
||||
(mapcar (lambda (type)
|
||||
(get-buffer
|
||||
(package-vc-tests-log-buffer-name type
|
||||
pkg)))
|
||||
(package-vc-tests-log-buffer-name pkg
|
||||
type)))
|
||||
'(doc make)))))
|
||||
(if (or (memq package-vc-tests-preserve-artefacts `(t ,pkg))
|
||||
(and (listp package-vc-tests-preserve-artefacts)
|
||||
|
|
@ -538,7 +538,7 @@ when PKG matches `package-vc-tests-preserve-artefacts'."
|
|||
(dolist (buffer buffers)
|
||||
(kill-buffer buffer)))))
|
||||
|
||||
(defun package-vc-with-installed-tests (pkg function)
|
||||
(defun package-vc-tests-with-installed (pkg function)
|
||||
"Call FUNCTION with PKG installed in a test environment.
|
||||
FUNCTION should have no arguments."
|
||||
(package-vc-with-tests-environment
|
||||
|
|
@ -670,7 +670,7 @@ car of ARGS (a symbol) to name of the package."
|
|||
:file-name ,file
|
||||
:body
|
||||
(lambda ()
|
||||
(package-vc-with-installed-tests
|
||||
(package-vc-tests-with-installed
|
||||
',pkg (funcall ,fn ',pkg))
|
||||
nil)))
|
||||
tests)))
|
||||
|
|
@ -932,7 +932,8 @@ car of ARGS (a symbol) to name of the package."
|
|||
|
||||
(package-vc-test-deftest prepare-patch (pkg)
|
||||
;; Ensure `vc-prepare-patch' respects subject from function argument
|
||||
(let ((vc-prepare-patches-separately nil))
|
||||
(let ((message-auto-save-directory package-vc-tests-dir)
|
||||
(vc-prepare-patches-separately nil))
|
||||
(package-vc-prepare-patch (package-vc-tests-package-desc pkg t)
|
||||
"test-subject"
|
||||
(cdr package-vc-tests-repository))
|
||||
Loading…
Add table
Add a link
Reference in a new issue