Opened 3 years ago
Closed 3 years ago
#32808 closed Bug (fixed)
DiscoverRunner.build_suite() does not restore self.test_loader.testNamePatterns
Reported by: | Chris Jerdonek | Owned by: | Mariusz Felisiak |
---|---|---|---|
Component: | Testing framework | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
DiscoverRunner.build_suite()
does not restore self.test_loader.testNamePatterns
after setting it in this line:
https://github.com/django/django/blob/e703b152c6148ddda1b072a4353e9a41dca87f90/django/test/runner.py#L639
I noticed this issue when finding a test isolation issue while working on #24522. The test test_runner.test_discover_runner.DiscoverRunnerTests.test_name_patterns
passes test_name_patterns
to DiscoverRunner
:
https://github.com/django/django/blob/e703b152c6148ddda1b072a4353e9a41dca87f90/tests/test_runner/test_discover_runner.py#L119-L122
And this causes some later tests to fail.
Change History (5)
comment:1 by , 3 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 3 years ago
Thanks! Yes, or even smaller--
$ ./runtests.py test_runner.test_discover_runner.DiscoverRunnerTests.test_name_patterns test_runner.tests.TestSuiteTests.test_iter_test_cases_mixed_test_suite_classes
comment:3 by , 3 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Good catch! A minimal set of tests to reproduce: