From 192342a3a93a2e467ab589ae2d1ffd5e7acf1398 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Mon, 31 Jul 2017 21:51:12 +0900 Subject: [PATCH] dired-tests: Unload tested features after test them Some tests are for Dired with ls-lisp or eshell-ls. Requiring these features add an advice on `dired' and might affect other tests. Do not require these features at the top of the file; require then inside the tests and unload then at the end. * test/lisp/dired-tests.el (dired-test-bug27693) (dired-test-bug7131, dired-test-bug27817, dired-test-bug27631): require ls-lisp and/or eshell-ls inside the test; unload the features at the end. --- test/lisp/dired-tests.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index cd58edaa3f8..d6fe839708d 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -21,7 +21,6 @@ (require 'ert) (require 'dired) (require 'nadvice) -(require 'ls-lisp) (ert-deftest dired-autoload () "Tests to see whether dired-x has been autoloaded" @@ -212,6 +211,7 @@ (ert-deftest dired-test-bug27693 () "Test for http://debbugs.gnu.org/27693 ." + (require 'ls-lisp) (let ((dir (expand-file-name "lisp" source-directory)) (size "") ls-lisp-use-insert-directory-program buf) @@ -223,6 +223,7 @@ (file-attributes (dired-get-filename))))) (search-backward-regexp size nil t) (should (looking-back "[[:space:]]" (1- (point))))) + (unload-feature 'ls-lisp 'force) (when (buffer-live-p buf) (kill-buffer buf))))) (ert-deftest dired-test-bug7131 () @@ -244,6 +245,7 @@ (ert-deftest dired-test-bug27762 () "Test for http://debbugs.gnu.org/27762 ." :expected-result :failed + (require 'ls-lisp) (let* ((dir source-directory) (default-directory dir) (files (mapcar (lambda (f) (concat "src/" f)) @@ -262,6 +264,7 @@ (should (looking-at "src")) (next-line) ; File names must be aligned. (should (looking-at "src"))) + (unload-feature 'ls-lisp 'force) (when (buffer-live-p buf) (kill-buffer buf))))) (ert-deftest dired-test-bug27817 () @@ -275,6 +278,7 @@ (customize-set-variable 'eshell-ls-use-in-dired t) (should (setq buf (dired source-directory)))) (customize-set-variable 'eshell-ls-use-in-dired orig) + (unload-feature 'em-ls 'force) (and (buffer-live-p buf) (kill-buffer))))) (ert-deftest dired-test-bug27631 () @@ -311,6 +315,7 @@ (setq buf (dired (expand-file-name "dir*/*.txt" dir))) (dired-toggle-marks) (should (cdr (dired-get-marked-files))))) + (unload-feature 'em-ls 'force) (delete-directory dir 'recursive) (when (buffer-live-p buf) (kill-buffer buf))))) -- 2.39.2