pytest-dev / pytest-dev/pytest-django

pytest-django + pytest-xdist + sqlite with django-tests and function tests

Open
#92 7 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

Hi, as i said in https://github.com/pelme/pytest_django/issues/88
it still problem with pytest/django/xdist/sqlite.
I make a repo with example to reproduce https://github.com/l0kix2/tmp-pytest-django-example.
Database access not allowed, use the "django_db" mark to enable but i have mark https://github.com/l0kix2/tmp-pytest-django-example/blob/master/tests/test_functions.py

Tests works fine without xdist, but when i have -n2 they fails. I'm not sure, but i think it somehow connected with running test of different types in one session (django.TestCase and functions with marks), because separately they works fine.

Thanks.

//cc @campos-ddc

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

Clone the linked tmp-pytest-django-example repository and inspect tests/test_functions.py alongside the Django TestCase tests. Run the suite with and without pytest-xdist using -n2 to reproduce the database-access error, then trace how the django_db mark and database setup behave across the two test styles. Done means both test types pass together under xdist with SQLite.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python, sqlite
Domain
backend, databases, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.