bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51941: Detect duplication of ERT tests


From: Mattias Engdegård
Subject: bug#51941: Detect duplication of ERT tests
Date: Wed, 24 Nov 2021 11:00:30 +0100

24 nov. 2021 kl. 10.29 skrev Ihor Radchenko <yantar92@gmail.com>:

> 1. load-file test-oc
>   1.1. test-oc requires test-ox
> 2. load file test-ox triggers error:
>   Debugger entered--Lisp error: (error "Test ‘test-org-export/bind-keyword’ 
> redefined")

Thank you, that was very clear.

Best practice is to run each ERT test file in a separate Emacs process. This 
ensures isolation between the tests, which can be quite important, but also 
permits them to be run in parallel. Easiest is to do this from a Makefile but 
you could of course do it from a controlling Emacs process if you prefer that.

Now if you for some reason want to stick with running them all in a single 
process, which I would advice against, then at least avoid the load-file if the 
file has already been loaded. Maybe use `require` with a file argument instead 
of load-file.

As a last resort you could insert something like (ert-delete-all-tests) between 
the test runs, but then you would no longer get the benefit of the global ERT 
test duplication check that is the one advantage of running them all in the 
same process.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]