Skip to content

Commit f70cb89

Browse files
committed
Consider testpaths config when looking for manage.py
1 parent 4d61618 commit f70cb89

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pytest_django/plugin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _handle_import_error(extra_message):
114114
raise ImportError(msg)
115115

116116

117-
def _add_django_project_to_path(args):
117+
def _add_django_project_to_path(early_config, args):
118118
def is_django_project(path):
119119
return path.is_dir() and (path / 'manage.py').exists()
120120

@@ -123,7 +123,8 @@ def find_django_path(args):
123123
args = [p for p in args if p.is_dir()]
124124

125125
if not args:
126-
args = [pathlib.Path.cwd()]
126+
args = [pathlib.Path(x) for x in early_config.getini('testpaths')
127+
] + [pathlib.Path.cwd()]
127128

128129
for arg in args:
129130
if is_django_project(arg):
@@ -199,7 +200,7 @@ def pytest_load_initial_conftests(early_config, parser, args):
199200
early_config.getini('django_find_project'), 'django_find_project')
200201

201202
if django_find_project:
202-
_django_project_scan_outcome = _add_django_project_to_path(args)
203+
_django_project_scan_outcome = _add_django_project_to_path(early_config, args)
203204
else:
204205
_django_project_scan_outcome = PROJECT_SCAN_DISABLED
205206

0 commit comments

Comments
 (0)