Skip to content

Commit

Permalink
Consider testpaths config when looking for manage.py
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Jul 30, 2018
1 parent 4d61618 commit f70cb89
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pytest_django/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _handle_import_error(extra_message):
raise ImportError(msg)


def _add_django_project_to_path(args):
def _add_django_project_to_path(early_config, args):
def is_django_project(path):
return path.is_dir() and (path / 'manage.py').exists()

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

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

for arg in args:
if is_django_project(arg):
Expand Down Expand Up @@ -199,7 +200,7 @@ def pytest_load_initial_conftests(early_config, parser, args):
early_config.getini('django_find_project'), 'django_find_project')

if django_find_project:
_django_project_scan_outcome = _add_django_project_to_path(args)
_django_project_scan_outcome = _add_django_project_to_path(early_config, args)
else:
_django_project_scan_outcome = PROJECT_SCAN_DISABLED

Expand Down

0 comments on commit f70cb89

Please sign in to comment.