Closed deronnax closed 6 months ago
I didn't know there was a --shuffle option.
I will experiment with it and try to understand what it does. As it turns out, there's still a lot I don't know about Django, thanks ! I will work on that issue to resolve it.
--shuffle
shuffles (randomizes) the test run order, which is otherwise deterministic. Because of this determinist order, developers tend to rely on this order and assume certains behaviors, partucularly about objects created in setUp
, modified in some tests and then tests somewhere else. But that's a fault: tests should be Isolated (self-sufficient), and hence order independant (see the FIRST test principle).
Also, did you know about the --parallel [n]
options? It split the test suite in [n] subprocesses, which roughly divides the test suite run time by the number of logical core of your machine. Very handy. But it also obviously change the test run order grouping from the "normal" non-parallel run, and I get a bunch of random failures when I use it. But when I don't use it, the test suite takes 5 times the duration.
I see you are French, so we could schedule a call, there I could of things I could tell you about Django (I am no expert but I have been fiddling with it for a while).
No, I didn't really check, it just occurred to me that it would have been great, but I never looked to see if it existed. I'll look into it a bit more.
I see you are French, so we could schedule a call, there I could of things I could tell you about Django (I am no expert but I have been fiddling with it for a while).
I'm not an expert either 😂 but I've been playing with it for about 5 years now. We certainly can when you have time, and thanks for the explanation, it will be put in good use.
I sent you a message on the contact form of your website ;)
On the main branch:
You can reproduce these failures by re-running the test suite shuffled with the same seed:
./manage.py test appointment.tests.utils.test_db_helpers --shuffle 4356288042
.I notice that objects created in
setUp
sometime are mutated elsewhere, that might be a cause.