pytest-dev / pytest-dev/pytest-django

No fixtures created when running with xdist

Open
#285 3 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

I have a class based test architecture. When I'm running py.test some/test/file.py, I get green tests. But once I run passing -n 2 with xdist, then for some reason my fixtures are not created.

class BaseTest(object):
    fixtures = ['fixture-file.json']

class Test(BaseTest, TestCase):
    def test_something():
        # At this point no fixtures is loaded if we're in an xdist process

Any idea if that's a bug or if something I'm doing might be confusing the system?

(I know the architecture described here is not ideal. But I'm working on a fairly large legacy code base.)

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

Reproduce the report using py.test some/test/file.py and the same command with -n 2, starting from the class-based setup in some/test/file.py with BaseTest.fixtures and Test. Compare fixture availability in the xdist process; done means the reported fixture is created and loaded consistently in both runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.