Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#32611 closed Cleanup/optimization (fixed)

runtests.py's bisect_tests() and paired_tests() don't always need to do setup and teardown

Reported by: Chris Jerdonek Owned by: Chris Jerdonek
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 Chris Jerdonek)

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 (10)

comment:1 by Chris Jerdonek, 3 years ago

Description: modified (diff)

comment:2 by Chris Jerdonek, 3 years ago

Description: modified (diff)

comment:3 by Chris Jerdonek, 3 years ago

Type: UncategorizedCleanup/optimization

comment:5 by Chris Jerdonek, 3 years ago

Description: modified (diff)
Summary: runtest.py's bisect_tests() and paired_tests() don't seem to need settings setup and teardownruntests.py's bisect_tests() and paired_tests() don't always need to do setup and teardown

comment:6 by Carlton Gibson, 3 years ago

Triage Stage: UnreviewedAccepted

OK, thanks Chris. At a quick glance the PR seems reasonable so let's take this for review. 👍

comment:7 by Girish Sontakke, 3 years ago

Owner: changed from nobody to Chris Jerdonek
Status: newassigned

comment:8 by Mariusz Felisiak, 3 years ago

Triage Stage: AcceptedReady for checkin

comment:9 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 9fa84600:

Fixed #32611 -- Prevented unecessary setup()/teardown() calls when using --bisect/--pair runtests options.

This commit changes runtests.py's bisect_tests() and paired_tests() to
change settings only when necessary, namely when specific test names
aren't provided.

comment:10 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In a41ed8f1:

Refs #32611 -- Removed initial "Testing against ..." log message calls from --bisect/--pair runtests options.

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