diff options
| author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2021-03-11 23:06:29 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-12 08:06:29 +0100 |
| commit | 551b0f94bf62c81d9ff9d5f7e261bcd2a594a4d1 (patch) | |
| tree | d204bdd2bb64968be2b3718d03fd32cb7b1f3c32 | |
| parent | d828beb68f6b925217242e8f4faac2216f7c9c57 (diff) | |
Reduced nesting inside DiscoverRunner.build_suite().
| -rw-r--r-- | django/test/runner.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/django/test/runner.py b/django/test/runner.py index dbbd03441a..c11681fde8 100644 --- a/django/test/runner.py +++ b/django/test/runner.py @@ -589,14 +589,13 @@ class DiscoverRunner: top_level = label_as_path while True: init_py = os.path.join(top_level, '__init__.py') - if os.path.exists(init_py): - try_next = os.path.dirname(top_level) - if try_next == top_level: - # __init__.py all the way down? give up. - break - top_level = try_next - continue - break + if not os.path.exists(init_py): + break + try_next = os.path.dirname(top_level) + if try_next == top_level: + # __init__.py all the way down? give up. + break + top_level = try_next kwargs['top_level_dir'] = top_level if not (tests and tests.countTestCases()) and is_discoverable(label): |
