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