You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 29, 2024. It is now read-only.
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:
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.
The text was updated successfully, but these errors were encountered:
bobobox
changed the title
Fixture scope: All scopes behave as if function scoped, even with 1 process and 1 thread
Fixture Scope: All scopes behave as if function scoped, even with 1 process and 1 thread
Sep 11, 2020
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.
The text was updated successfully, but these errors were encountered: