From: Xiyue Deng <manphiz@gmail.com>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 66782@debbugs.gnu.org
Subject: bug#66782: 29.1; ERT tests report test redefined depending on loading sequence
Date: Thu, 02 Nov 2023 10:17:01 -0700 [thread overview]
Message-ID: <87fs1ohy7m.fsf@debian-hx90.lan> (raw)
In-Reply-To: <877cn3kfba.fsf@debian-hx90.lan> (Xiyue Deng's message of "Mon, 30 Oct 2023 13:47:53 -0700")
[-- Attachment #1: Type: text/plain, Size: 1978 bytes --]
Xiyue Deng <manphiz@gmail.com> writes:
> Mattias Engdegård <mattias.engdegard@gmail.com> writes:
>
>> 29 okt. 2023 kl. 22.53 skrev Xiyue Deng <manphiz@gmail.com>:
>>
>>> As far as I know, there is no practical use for a test case to depend on
>>> another test case in any language I worked with as a test case provides
>>> no reusable component. On the other hand, there are alternatives that
>>> makes more sense to do what they (e.g. lsp-mode) are doing. Again, IMHO
>>> I think it makes sense for ERT not to support it or to even forbid it.
>>> Doing this also avoids such misleading error message I was reporting,
>>> which got triggered depending on the loading sequence which may make
>>> test suites flaky (as the loading sequence is not deterministic).
>>
>> I don't think ERT can forbid anyone from loading in the same .el file multiple times because it's none of its business. Or did you have something else in mind?
>>
>
> It's not that loading the same .el multiple times that caused this
> error, but loading a module with `ert-deftest' and both .el modules are
> passed to batch ert processing which is common practice. But see below.
>
>> All in all, I'm not sure there is anything that we can do in Emacs right now that would help, but if you have any concrete suggestions, do tell.
>>
>
> I understand if upstream don't want to complicate `require' logic too
> much. However I wonder whether it's OK to add warning if a required
> module has `ert-deftest' in it, so that it can help people identify that
> a `Test "foo" redefined' error is due to requiring other module instead
> of an actual duplicated test name. How does this sound?
As I didn't get an answer I assume this was a no-go. So instead I'd
like to propose a slight change to the error message to mention that it
may also be caused by an ert test being loaded multiple times. Patch is
attached, please let me know whether this works.
--
Xiyue Deng
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Revise-test-redefined-error-message.patch --]
[-- Type: text/x-diff, Size: 1000 bytes --]
From 4efc6a84c4bb0758d67e2721fcb479494a312d69 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manphiz@gmail.com>
Date: Thu, 2 Nov 2023 10:08:48 -0700
Subject: [PATCH] Revise test redefined error message
Add the possibility that an ert test that is loaded multiple times may
trigger the same error (Bug#66782).
* lisp/emacs-lisp/ert.el (ert-set-test): Update error message.
---
lisp/emacs-lisp/ert.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index d727bc94ec5..4d189ed614e 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -152,7 +152,7 @@ mode.")
(when (and noninteractive (get symbol 'ert--test))
;; Make sure duplicated tests are discovered since the older test would
;; be ignored silently otherwise.
- (error "Test `%s' redefined" symbol))
+ (error "Test `%s' redefined or loaded multiple times" symbol))
(define-symbol-prop symbol 'ert--test definition)
definition)
--
2.39.2
next prev parent reply other threads:[~2023-11-02 17:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-27 20:59 bug#66782: 29.1; ERT tests reports test redefined depending on loading sequence Xiyue Deng
2023-10-28 6:32 ` Eli Zaretskii
2023-10-28 9:39 ` bug#66782: 29.1; ERT tests report " Xiyue Deng
2023-10-28 9:48 ` Eli Zaretskii
2023-10-28 11:14 ` Xiyue Deng
2023-10-28 11:34 ` Eli Zaretskii
2023-10-28 11:50 ` Xiyue Deng
2023-10-28 12:03 ` Eli Zaretskii
2023-10-28 12:46 ` Mattias Engdegård
2023-10-28 21:19 ` Xiyue Deng
2023-10-29 12:09 ` Mattias Engdegård
2023-10-29 21:53 ` Xiyue Deng
2023-10-30 12:04 ` Mattias Engdegård
2023-10-30 20:47 ` Xiyue Deng
2023-11-02 17:17 ` Xiyue Deng [this message]
2023-11-02 18:56 ` Mattias Engdegård
2023-11-02 22:00 ` Xiyue Deng
2023-11-03 17:14 ` Mattias Engdegård
2023-11-03 17:56 ` Xiyue Deng
2023-11-04 8:51 ` Eli Zaretskii
2023-10-28 19:41 ` Xiyue Deng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fs1ohy7m.fsf@debian-hx90.lan \
--to=manphiz@gmail.com \
--cc=66782@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=mattias.engdegard@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.