pytest-django icon indicating copy to clipboard operation
pytest-django copied to clipboard

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

Open icemac opened this issue 3 years ago • 0 comments

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

  • Check for (absolute) paths in https://github.com/pytest-dev/pytest-django/blob/f27c6aa1d44beb46fefa4718fefcf541478643d7/pytest_django/fixtures.py#L281 and handle it appropriately.

icemac avatar Apr 19 '22 10:04 icemac