pytest-dev / pytest-dev/pytest-django

django_find_project: inconsistent behavior with args

Open
#689 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.5k
Forks
367
PR merge metrics
No merged PRs in 30d

Description

The django_find_project option will not check for a Django project (manage.py) if run via pytest -k foo, since it will only look for manage.py from "foo".

The main issue here is: foo is not a file, but the value for the -k option, it should behave as with just pytest here. This requires to actually look at parsed args/options and not the raw args.

As a workaround we should add cwd always for the check (last), as with just using pytest.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the django_find_project option handling and compare parsed options with the raw arguments. Reproduce the behavior with pytest -k foo and plain pytest; done means both checks find manage.py consistently, including the cwd fallback described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
cli, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.