#32611: runtest.py's bisect_tests() and paired_tests() don't seem to need 
settings
setup and teardown
-------------------------------------+-------------------------------------
     Reporter:  Chris Jerdonek       |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Testing framework    |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
  runtests,bisect_tests,paired_tests |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Chris Jerdonek:

Old description:

> Currently, `runtest.py`'s
> [https://github.com/django/django/blob/main/tests/runtests.py#L346
> bisect_tests()] and
> [https://github.com/django/django/blob/main/tests/runtests.py#L397
> paired_tests()] both call `runtest.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) to do some work to compute
> `test_labels` in the case that `test_labels` aren't provided. So those
> 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.

New description:

 Currently, `runtest.py`'s
 [https://github.com/django/django/blob/main/tests/runtests.py#L346
 bisect_tests()] and
 [https://github.com/django/django/blob/main/tests/runtests.py#L397
 paired_tests()] both call `runtest.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.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32611#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.d852f6a5bd7bd7dc70ded8692af3369f%40djangoproject.com.

Reply via email to