pytest-dev / pytest-dev/pytest-django
Running tests in parallel breaks when using absolute path to SQLite database
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
What I did
- Ran tests of a Django project using
tox -p– soTOX_PARALLEL_ENVis set totrue. - I set the path to the SQLite database to be used as absolute path.
What I expected
- Successful run in parallel for the different
toxenvironments.
What actually happened
pytest-djangochanged the path to the database file while breaking the path.- Example: database name
/home/user/project/my-project.sqliteintoxenvpy39caused that the database name is changed totest_/home/user/project/my-project.sqlite_py39which is not a valid path on user's hard disk.
Suggestion
- Check for (absolute) paths in https://github.com/pytest-dev/pytest-django/blob/f27c6aa1d44beb46fefa4718fefcf541478643d7/pytest_django/fixtures.py#L281 and handle it appropriately.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pytest_django/fixtures.py around line 281 and reproduce the issue with an absolute SQLite path while running tox -p with TOX_PARALLEL_ENV set. Trace how the database name is changed for each environment, then add or update regression coverage so parallel runs preserve a valid absolute path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python, sqlite
- Domain
- databases, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100