pytest-dev / pytest-dev/pytest-django

Running tests in parallel breaks when using absolute path to SQLite database

Open
#1,008 0 comments 0 reactions 0 assignees View on GitHub

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 – so TOX_PARALLEL_ENV is set to true.
  • I set the path to the SQLite database to be used as absolute path.
What I expected
  • Successful run in parallel for the different tox environments.
What actually happened
  • pytest-django changed the path to the database file while breaking the path.
  • Example: database name /home/user/project/my-project.sqlite in tox env py39 caused that the database name is changed to test_/home/user/project/my-project.sqlite_py39 which is not a valid path on user's hard disk.
Suggestion

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.