Skip to content

Commit c08870b

Browse files
committed
Minimised repro case for pytest-dev#67
1 parent b274232 commit c08870b

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

testing/test_issue67_a.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Minimal repro case for https://github.com/pytest-dev/pytest-forked/issues/67.
2+
See also: `test_issue67_z.py`"""
3+
4+
import pytest
5+
6+
7+
def test_asetup_for_failure():
8+
"Non-forked test to get current module onto SetupState"
9+
pass
10+
11+
12+
@pytest.mark.forked
13+
def test_yyy():
14+
"""
15+
Forked test as last test in the module.
16+
17+
This way, teardown phase of previous test does not remove `test_issue67_a` module
18+
from the stack, and forked setups/teardowns do not leave the containment of the forked
19+
process.
20+
"""
21+
pass
22+
23+
24+
# Uncomment me to make tests pass O_-
25+
def test_zcleanup():
26+
"""As long as the last teardown of the module is ran in-process, stack should
27+
stay valid for next module"""
28+
pass

testing/test_issue67_z.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"Second part of pytest>=7 incompatibility repro case. See also: `test_issue67_a.py`"
2+
3+
4+
def test_no_forky():
5+
"""When ran after `test_issue67_a.py`, this test will explode because
6+
`test_issue67_a` module is still on stack"""
7+
pass

tox.ini

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[tox]
22
# if you change the envlist, please update .travis.yml file as well
3-
minversion = 3.7.0
3+
minversion = 3.8.0
44
isolated_build = true
55
envlist=
6-
py{37,38,39,310,311}-pytest{310,46,54,62,latest}
6+
py{38,39,310,311}-pytest{62,74,latest}
77
flakes
88
build-dists
99
metadata-validation
@@ -13,10 +13,8 @@ deps =
1313
pycmd
1414
# to avoid .eggs
1515
setuptools_scm
16-
pytest310: pytest~=3.10
17-
pytest46: pytest~=4.6
18-
pytest54: pytest~=5.4
1916
pytest62: pytest~=6.2
17+
pytest74: pytest~=7.4
2018
pytestlatest: pytest
2119
pytestmain: git+https://github.com/pytest-dev/pytest.git@main
2220
platform=linux|darwin

0 commit comments

Comments
 (0)