diff options
| author | Stefan Kangas | 2025-03-02 13:26:43 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2025-03-02 13:37:34 +0100 |
| commit | e4d8095c3dccc4f37be54b083d8b511fac0142b3 (patch) | |
| tree | e2affbb4c459db81734e1983c06f928d76ac01cf | |
| parent | c73003ade161a50728aa15cc10967ad04fe90b05 (diff) | |
| download | emacs-e4d8095c3dccc4f37be54b083d8b511fac0142b3.tar.gz emacs-e4d8095c3dccc4f37be54b083d8b511fac0142b3.zip | |
Fix a vc test for Breezy by setting $HOME
* test/lisp/vc/vc-tests.el (vc--fix-home-for-bzr): New macro.
(vc-test--create-repo, vc-test--register, vc-test--working-revision)
(vc-test--checkout-model, vc-test--rename-file)
(vc-test--version-diff): Fix test for Breezy by setting HOME to a
temporary directory. (Bug#70195)
| -rw-r--r-- | test/lisp/vc/vc-tests.el | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el index 62938c41227..49a6f2c38f5 100644 --- a/test/lisp/vc/vc-tests.el +++ b/test/lisp/vc/vc-tests.el | |||
| @@ -177,6 +177,12 @@ For backends which don't support it, it is emulated." | |||
| 177 | 177 | ||
| 178 | (t (vc-create-repo backend)))) | 178 | (t (vc-create-repo backend)))) |
| 179 | 179 | ||
| 180 | (defmacro vc--fix-home-for-bzr (tempdir) | ||
| 181 | ;; See the comment in `vc-bzr-test-bug9726'. | ||
| 182 | '(when (eq backend 'Bzr) | ||
| 183 | (push (format "BZR_HOME=%s" tempdir) process-environment) | ||
| 184 | (push (format "HOME=%s" tempdir) process-environment))) | ||
| 185 | |||
| 180 | (defun vc-test--create-repo (backend) | 186 | (defun vc-test--create-repo (backend) |
| 181 | "Create a test repository in `default-directory', a temporary directory." | 187 | "Create a test repository in `default-directory', a temporary directory." |
| 182 | (ert-with-temp-directory tempdir | 188 | (ert-with-temp-directory tempdir |
| @@ -187,10 +193,7 @@ For backends which don't support it, it is emulated." | |||
| 187 | (make-temp-name "vc-test") temporary-file-directory))) | 193 | (make-temp-name "vc-test") temporary-file-directory))) |
| 188 | (process-environment process-environment) | 194 | (process-environment process-environment) |
| 189 | vc-test--cleanup-hook) | 195 | vc-test--cleanup-hook) |
| 190 | (when (eq backend 'Bzr) | 196 | (vc--fix-home-for-bzr tempdir) |
| 191 | (setq process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 192 | process-environment))) | ||
| 193 | |||
| 194 | (unwind-protect | 197 | (unwind-protect |
| 195 | (progn | 198 | (progn |
| 196 | ;; Cleanup. | 199 | ;; Cleanup. |
| @@ -242,9 +245,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 242 | (make-temp-name "vc-test") temporary-file-directory))) | 245 | (make-temp-name "vc-test") temporary-file-directory))) |
| 243 | (process-environment process-environment) | 246 | (process-environment process-environment) |
| 244 | vc-test--cleanup-hook) | 247 | vc-test--cleanup-hook) |
| 245 | (when (eq backend 'Bzr) | 248 | (vc--fix-home-for-bzr tempdir) |
| 246 | (setq process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 247 | process-environment))) | ||
| 248 | (unwind-protect | 249 | (unwind-protect |
| 249 | (progn | 250 | (progn |
| 250 | ;; Cleanup. | 251 | ;; Cleanup. |
| @@ -323,9 +324,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 323 | (make-temp-name "vc-test") temporary-file-directory))) | 324 | (make-temp-name "vc-test") temporary-file-directory))) |
| 324 | (process-environment process-environment) | 325 | (process-environment process-environment) |
| 325 | vc-test--cleanup-hook) | 326 | vc-test--cleanup-hook) |
| 326 | (when (eq backend 'Bzr) | 327 | (vc--fix-home-for-bzr tempdir) |
| 327 | (setq process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 328 | process-environment))) | ||
| 329 | (unwind-protect | 328 | (unwind-protect |
| 330 | (progn | 329 | (progn |
| 331 | ;; Cleanup. | 330 | ;; Cleanup. |
| @@ -388,10 +387,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 388 | (make-temp-name "vc-test") temporary-file-directory))) | 387 | (make-temp-name "vc-test") temporary-file-directory))) |
| 389 | (process-environment process-environment) | 388 | (process-environment process-environment) |
| 390 | vc-test--cleanup-hook) | 389 | vc-test--cleanup-hook) |
| 391 | (when (eq backend 'Bzr) | 390 | (vc--fix-home-for-bzr tempdir) |
| 392 | (setq process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 393 | process-environment))) | ||
| 394 | |||
| 395 | (unwind-protect | 391 | (unwind-protect |
| 396 | (progn | 392 | (progn |
| 397 | ;; Cleanup. | 393 | ;; Cleanup. |
| @@ -466,10 +462,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 466 | (make-temp-name "vc-test") temporary-file-directory))) | 462 | (make-temp-name "vc-test") temporary-file-directory))) |
| 467 | (process-environment process-environment) | 463 | (process-environment process-environment) |
| 468 | vc-test--cleanup-hook) | 464 | vc-test--cleanup-hook) |
| 469 | (when (eq backend 'Bzr) | 465 | (vc--fix-home-for-bzr tempdir) |
| 470 | (setq process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 471 | process-environment))) | ||
| 472 | |||
| 473 | (unwind-protect | 466 | (unwind-protect |
| 474 | (progn | 467 | (progn |
| 475 | ;; Cleanup. | 468 | ;; Cleanup. |
| @@ -549,10 +542,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 549 | (make-temp-name "vc-test") temporary-file-directory))) | 542 | (make-temp-name "vc-test") temporary-file-directory))) |
| 550 | (process-environment process-environment) | 543 | (process-environment process-environment) |
| 551 | vc-test--cleanup-hook) | 544 | vc-test--cleanup-hook) |
| 552 | (when (eq backend 'Bzr) | 545 | (vc--fix-home-for-bzr tempdir) |
| 553 | (setq process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 554 | process-environment))) | ||
| 555 | |||
| 556 | (unwind-protect | 546 | (unwind-protect |
| 557 | (progn | 547 | (progn |
| 558 | ;; Cleanup. | 548 | ;; Cleanup. |
| @@ -601,9 +591,7 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 601 | (make-temp-name "vc-test") temporary-file-directory)))) | 591 | (make-temp-name "vc-test") temporary-file-directory)))) |
| 602 | (process-environment process-environment) | 592 | (process-environment process-environment) |
| 603 | vc-test--cleanup-hook) | 593 | vc-test--cleanup-hook) |
| 604 | (when (eq backend 'Bzr) | 594 | (vc--fix-home-for-bzr tempdir) |
| 605 | (setq process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 606 | process-environment))) | ||
| 607 | ;; git tries various approaches to guess a user name and email, | 595 | ;; git tries various approaches to guess a user name and email, |
| 608 | ;; which can fail depending on how the system is configured. | 596 | ;; which can fail depending on how the system is configured. |
| 609 | ;; Eg if the user account has no GECOS, git commit can fail with | 597 | ;; Eg if the user account has no GECOS, git commit can fail with |