Opened 4 years ago
Last modified 4 years ago
#32611 closed Cleanup/optimization
runtests.py's bisect_tests() and paired_tests() don't always need to do setup and teardown — at Version 5
Reported by: | Chris Jerdonek | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Normal | Keywords: | runtests, bisect_tests, paired_tests |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Currently, runtests.py
's bisect_tests() and paired_tests() both call runtests.py
's setup()
and teardown()
. However, it doesn't seem like they need to (in full).
The setup()
function's primary purpose is to temporarily set settings
for the purposes of the test run, but bisect_tests()
and paired_tests()
both run tests in a subprocess, so settings modification doesn't seem like it should be necessary. The only things the call to setup()
seem to be needed for in these two cases is to (1) do some initial logging of the test run, and (2) do some work to compute test_labels
in the case that test_labels
aren't provided. So those pieces could be factored out.
Here is the commit where the calls to setup()
were first added: https://github.com/django/django/commit/18c3ea5546566e8fe1471ea87942b2864040452d
This is related to (but separate from) #32609.
Change History (5)
comment:1 by , 4 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
Description: | modified (diff) |
---|
comment:3 by , 4 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:4 by , 4 years ago
Has patch: | set |
---|
comment:5 by , 4 years ago
Description: | modified (diff) |
---|---|
Summary: | runtest.py's bisect_tests() and paired_tests() don't seem to need settings setup and teardown → runtests.py's bisect_tests() and paired_tests() don't always need to do setup and teardown |
PR: https://github.com/django/django/pull/14230