Opened 13 months ago

Last modified 13 months ago

#31621 assigned New feature

Add "--parallel=auto" option to the "test" command.

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Testing framework Version: dev
Severity: Normal Keywords:
Cc: Sergey Fedoseev Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


The --parallel flag to test is used as a binary "on" to mean "on all cores." But it also tries to parse the value after it as a number. This is annoying as there's no easy way to alias it as "on", since when adding a test name afterwards it is parsed as an integer:

$ python test --parallel example.core.tests.test_a
usage: test [-h] [--noinput] [--failfast] ... test: error: argument --parallel: invalid int value: 'example.core.tests.test_a'

Pytest's xdist plugin supports the value "auto" to mean "all cores." I suggest we copy that.

Change History (6)

comment:1 Changed 13 months ago by Adam Johnson

Has patch: set

comment:2 Changed 13 months ago by Mariusz Felisiak

Owner: changed from nobody to Adam Johnson
Summary: Add ability to specify "all cores" to "test --parallel"Add "--parallel=auto" option to the "test" command.
Triage Stage: UnreviewedAccepted
Type: Cleanup/optimizationNew feature

comment:3 Changed 13 months ago by Ahmad A. Hussein

Triage Stage: AcceptedReady for checkin

Patch looks good

comment:4 Changed 13 months ago by Mariusz Felisiak

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

comment:5 Changed 13 months ago by Sergey Fedoseev

Cc: Sergey Fedoseev added

What about this?

$ python test --parallel -- example.core.tests.test_a

comment:6 Changed 13 months ago by Adam Johnson

That works. However if you use it in e.g. an alias with alias test='python test --parallel --', then you can no longer pass extra flags.

Note: See TracTickets for help on using tickets.
Back to Top