Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] consider testpaths config when looking for manage.py #478

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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