To clarify, I understand that session is not shared between processes or threads (which seems to be a common point of confusion when using either pytest-parallel or pytest-xdist), but what I'm seeing is that, even with --workers 1 --tests-per-worker 1 (and everything beyond), fixtures scoped to session, class, etc all get re-run for every single test.
ie. there are two unique IDs, for two sessions, one per worker (or thread).
Actual results
However, whenever pytest-parallel is involved, even if set to --workers 1 --tests-per-worker 1 (which should mean no concurrency or parallelism at all), every single test function appears to effectively have its own session:
Versions:
Python 3.8.0, 3.7.5
pytest==6.0.1
pytest-parallel==0.1.0
Description
To clarify, I understand that
session
is not shared between processes or threads (which seems to be a common point of confusion when using eitherpytest-parallel
orpytest-xdist
), but what I'm seeing is that, even with--workers 1 --tests-per-worker 1
(and everything beyond), fixtures scoped tosession
,class
, etc all get re-run for every single test.For the simplest example:
conftest.py
test.py
Expected results
Since the fixture returns a unique UUID when run, one would expect output like this:
ie. there are two unique IDs, for two sessions, one per worker (or thread).
Actual results
However, whenever
pytest-parallel
is involved, even if set to--workers 1 --tests-per-worker 1
(which should mean no concurrency or parallelism at all), every single test function appears to effectively have its ownsession
:ie. There are four unique UUIDs, not the expected two.
For what it's worth, I don't have this issue with
pytest-xdist
: When running with-n 2
for example, there are two unique UUIDs among the four tests.Is this expected? It seems like a bug, and I can't find it documented, but perhaps I'm misunderstanding something about how this all works.