Changes between Initial Version and Version 1 of Ticket #32540


Ignore:
Timestamp:
Mar 12, 2021, 1:24:44 AM (4 years ago)
Author:
Chris Jerdonek
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32540 – Description

    initial v1  
    1 Currently, `DiscoverRunner.build_suite()` is a bit confusing to read because it does [https://github.com/django/django/blob/551b0f94bf62c81d9ff9d5f7e261bcd2a594a4d1/django/test/runner.py#L577-L599 "top level" detection] for test discovery even when discovery won't be taking place.
     1Currently, `DiscoverRunner.build_suite()` is a bit confusing to read because it does [https://github.com/django/django/blob/551b0f94bf62c81d9ff9d5f7e261bcd2a594a4d1/django/test/runner.py#L576-L599 "top level" detection] for test discovery even when discovery won't be taking place.
    22
    33My suggestion is to move the top-level detection logic (and large code comment) into a `find_top_level(top_level)` function that is placed immediately before where `is_discoverable()` is defined. Then, only call `find_top_level()` when needed, namely right before where [https://github.com/django/django/blob/551b0f94bf62c81d9ff9d5f7e261bcd2a594a4d1/django/test/runner.py#L603 self.test_loader.discover()] is called.
Back to Top