-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
While working on #110160 I've noticed that it is rather hard to reproduce random test failures. So, I want to propose a new feature / fix for that.
First of all, there's existing prior work of @vstinner who added --randseed
flag.
Right now it is used together with -r
to randomize test order and seeding random.
I propose to:
- Split
--randseed
into two options: test order randomization andrandom.seed
usage - Let's keep
-r
as-is - Let's add
--no-use-randseed
flag to disable settingrandom.seed
, let's always seed random by default - Always print information about current random seed to be able to reuse it in the next runs
Example:
» ./python.exe -m test test_regrtest
Using random seed 65906482
0:00:00 load avg: 1.55 Run 1 test sequentially
0:00:00 load avg: 1.55 [1/1] test_regrtest
== Tests result: SUCCESS ==
1 test OK.
Total duration: 12.7 sec
Total tests: run=102 skipped=2
Total test files: run=1/1
Result: SUCCESS
Basically, this is how https://github.com/pytest-dev/pytest-randomly works.
I have a PR ready.
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement