[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ed8b4e0: Prevent running vc-tests writing to ~/.bzr
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] master ed8b4e0: Prevent running vc-tests writing to ~/.bzr.log |
Date: |
Sat, 20 May 2017 20:00:29 -0400 (EDT) |
branch: master
commit ed8b4e0c0c5da838e639d1505bdd090a7e2d735f
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>
Prevent running vc-tests writing to ~/.bzr.log
* test/lisp/vc/vc-tests.el (vc-test--create-repo)
(vc-test--register, vc-test--working-revision)
(vc-test--checkout-model): Set temporary BZR_HOME, to disable logging.
---
test/lisp/vc/vc-tests.el | 45 ++++++++++++++++++++++++++++++++++++++-------
1 file changed, 38 insertions(+), 7 deletions(-)
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el
index 656f673..1104085 100644
--- a/test/lisp/vc/vc-tests.el
+++ b/test/lisp/vc/vc-tests.el
@@ -115,7 +115,7 @@
(defvar vc-test--cleanup-hook nil
"Functions for cleanup at the end of an ert test.
-Don't set it globally, the functions shall be let-bound.")
+Don't set it globally, the functions should be let-bound.")
(defun vc-test--revision-granularity-function (backend)
"Run the `vc-revision-granularity' backend function."
@@ -181,7 +181,13 @@ For backends which dont support it, it is emulated."
(file-name-as-directory
(expand-file-name
(make-temp-name "vc-test") temporary-file-directory)))
+ (process-environment process-environment)
+ tempdir
vc-test--cleanup-hook)
+ (when (eq backend 'Bzr)
+ (setq tempdir (make-temp-file "vc-test--create-repo" t)
+ process-environment (cons (format "BZR_HOME=%s" tempdir)
+ process-environment)))
(unwind-protect
(progn
@@ -201,7 +207,9 @@ For backends which dont support it, it is emulated."
(should (eq (vc-responsible-backend default-directory) backend)))
;; Save exit.
- (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
+ (ignore-errors
+ (if tempdir (delete-directory tempdir t))
+ (run-hooks 'vc-test--cleanup-hook)))))
;; FIXME: Why isn't there `vc-unregister'?
(defun vc-test--unregister-function (backend file)
@@ -231,8 +239,13 @@ This checks also `vc-backend' and
`vc-responsible-backend'."
(file-name-as-directory
(expand-file-name
(make-temp-name "vc-test") temporary-file-directory)))
+ (process-environment process-environment)
+ tempdir
vc-test--cleanup-hook)
-
+ (when (eq backend 'Bzr)
+ (setq tempdir (make-temp-file "vc-test--register" t)
+ process-environment (cons (format "BZR_HOME=%s" tempdir)
+ process-environment)))
(unwind-protect
(progn
;; Cleanup.
@@ -292,12 +305,14 @@ This checks also `vc-backend' and
`vc-responsible-backend'."
(should-not (vc-backend tmp-name2))
(should-not (vc-registered tmp-name2)))
- ;; The files shall still exist.
+ ;; The files should still exist.
(should (file-exists-p tmp-name1))
(should (file-exists-p tmp-name2))))
;; Save exit.
- (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
+ (ignore-errors
+ (if tempdir (delete-directory tempdir t))
+ (run-hooks 'vc-test--cleanup-hook)))))
(defun vc-test--state (backend)
"Check the different states of a file."
@@ -374,7 +389,13 @@ This checks also `vc-backend' and
`vc-responsible-backend'."
(file-name-as-directory
(expand-file-name
(make-temp-name "vc-test") temporary-file-directory)))
+ (process-environment process-environment)
+ tempdir
vc-test--cleanup-hook)
+ (when (eq backend 'Bzr)
+ (setq tempdir (make-temp-file "vc-test--working-revision" t)
+ process-environment (cons (format "BZR_HOME=%s" tempdir)
+ process-environment)))
(unwind-protect
(progn
@@ -435,7 +456,9 @@ This checks also `vc-backend' and `vc-responsible-backend'."
(should-not (vc-working-revision tmp-name)))))
;; Save exit.
- (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
+ (ignore-errors
+ (if tempdir (delete-directory tempdir t))
+ (run-hooks 'vc-test--cleanup-hook)))))
(defun vc-test--checkout-model (backend)
"Check the checkout model of a repository."
@@ -445,7 +468,13 @@ This checks also `vc-backend' and
`vc-responsible-backend'."
(file-name-as-directory
(expand-file-name
(make-temp-name "vc-test") temporary-file-directory)))
+ (process-environment process-environment)
+ tempdir
vc-test--cleanup-hook)
+ (when (eq backend 'Bzr)
+ (setq tempdir (make-temp-file "vc-test--checkout-model" t)
+ process-environment (cons (format "BZR_HOME=%s" tempdir)
+ process-environment)))
(unwind-protect
(progn
@@ -512,7 +541,9 @@ This checks also `vc-backend' and `vc-responsible-backend'."
'(announce implicit locking))))))
;; Save exit.
- (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
+ (ignore-errors
+ (if tempdir (delete-directory tempdir t))
+ (run-hooks 'vc-test--cleanup-hook)))))
;; Create the test cases.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master ed8b4e0: Prevent running vc-tests writing to ~/.bzr.log,
Glenn Morris <=