* testing/org-test.el: Avoid looking into .emacs.d when ran non-interactively

(org-test-load):
(org-test-update-id-locations): Set `org-id-locations-file' inside
test dir, but only when running in batch mode.

Reported-by: Morgan Smith <Morgan.J.Smith@outlook.com>
Link: https://orgmode.org/list/ub84qp$6pu$1@ciao.gmane.io
This commit is contained in:
Ihor Radchenko 2023-08-13 11:28:32 +03:00
parent 70a082c9fb
commit a0830f94ea
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 30 additions and 29 deletions

View File

@ -387,35 +387,34 @@ Tramp related features. We mostly follow
(defun org-test-load () (defun org-test-load ()
"Load up the Org test suite." "Load up the Org test suite."
(interactive) (interactive)
(setq org-id-locations-file (cl-flet
(expand-file-name ".test-org-id-locations" org-test-dir)) ((rld (base)
(cl-flet ((rld (base) ;; Recursively load all files, if files throw errors
;; Recursively load all files, if files throw errors ;; then silently ignore the error and continue to the
;; then silently ignore the error and continue to the ;; next file. This allows files to error out if
;; next file. This allows files to error out if ;; required executables aren't available.
;; required executables aren't available. (mapc
(mapc (lambda (path)
(lambda (path) (if (file-directory-p path)
(if (file-directory-p path) (rld path)
(rld path) (condition-case nil
(condition-case nil (when (string-match "\\`[A-Za-z].*\\.el\\'"
(when (string-match "\\`[A-Za-z].*\\.el\\'" (file-name-nondirectory path))
(file-name-nondirectory path)) (let ((feature-name
(let ((feature-name (intern
(intern (file-name-base
(file-name-base (file-name-nondirectory path)))))
(file-name-nondirectory path))))) (require feature-name path)))
(require feature-name path))) (missing-test-dependency
(missing-test-dependency (let ((name (intern
(let ((name (intern (concat "org-missing-dependency/"
(concat "org-missing-dependency/" (file-name-nondirectory
(file-name-nondirectory (file-name-sans-extension path))))))
(file-name-sans-extension path)))))) (eval `(ert-deftest ,name ()
(eval `(ert-deftest ,name () (skip-unless nil) ;; Make it prominent.
(skip-unless nil) ;; Make it prominent. :expected-result :failed (should nil))))))))
:expected-result :failed (should nil)))))))) (directory-files base 'full
(directory-files base 'full "\\`\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el\\'"))))
"\\`\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el\\'"))))
(rld (expand-file-name "lisp" org-test-dir)))) (rld (expand-file-name "lisp" org-test-dir))))
(defun org-test-current-defun () (defun org-test-current-defun ()
@ -447,6 +446,8 @@ Tramp related features. We mostly follow
(when (buffer-live-p b) (kill-buffer b))))) (when (buffer-live-p b) (kill-buffer b)))))
(defun org-test-update-id-locations () (defun org-test-update-id-locations ()
(setq org-id-locations-file
(expand-file-name ".test-org-id-locations" org-test-dir))
(org-id-update-id-locations (org-id-update-id-locations
(directory-files (directory-files
org-test-example-dir 'full org-test-example-dir 'full