Skip to content

Session-Scoped Fixtures are not Session-Scoped with Pytest-Xdist #271

@drake-mer

Description

@drake-mer

I am fairly new to this project. I very recently migrated a software project test-suite from nosetest to pytest, mainly because of the Xdist benefits I had heard of.

The problem is that my Tests are depending on a big fixture setup (table creation + heavy loading of data) that I would like to share across all my tests.

The current Xdist behaviour is as follow:

  1. Collect test
  2. Split tests amongst the user-defined number of processes
  3. Launch a pytest session for each worker

Obviously, if each test depend on a heavy fixture, then multiplying the number of creation per number of worker is not going to help.

Additionally, it simply breaks the expected pytest behaviour for 'session' scoped fixtures.

I think this should be fairly simple to address this problem although I didn't take a really deep look into it. If you need help to solve this problem, I am more than willing to contribute if you feel this suggestion for improvement is relevant.

Greetings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions