I expect only 1 setup/teardown
$ python -m pytest -s
========================================================================== test session starts ===========================================================================
platform linux2 -- Python 2.7.13, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /home/*****/devel/test, inifile:
plugins: xdist-1.22.2, cov-2.5.1, teamcity-messages-1.21, forked-0.2, repeat-0.4.1, hypothesis-3.56.5
collected 2 items
test_1.py setup
(<frame object at 0x7ff2c97fa730>, '/home/*****/devel/test/__init__.py', 6, 'F', [' yield inspect.stack()[0]\n'], 0)
.
test_2.py setup
(<frame object at 0x7ff2c97faaa0>, '/home/*****/devel/test/__init__.py', 6, 'F', [' yield inspect.stack()[0]\n'], 0)
.teardown
teardown
======================================================================== 2 passed in 0.02 seconds ========================================================================
$ python3 -m pytest -s
========================================================================== test session starts ===========================================================================
platform linux -- Python 3.6.1, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /home/*****/devel/test, inifile:
plugins: teamcity-messages-1.21, cov-2.5.1
collected 2 items
test_1.py setup
FrameInfo(frame=<frame object at 0x7f21574c08b8>, filename='/home/*****/devel/test/__init__.py', lineno=6, function='F', code_context=[' yield inspect.stack()[0]\n'], index=0)
.
test_2.py setup
FrameInfo(frame=<frame object at 0x7f21574c0c18>, filename='/home/*****/devel/test/__init__.py', lineno=6, function='F', code_context=[' yield inspect.stack()[0]\n'], index=0)
.teardown
teardown
======================================================================== 2 passed in 0.03 seconds ========================================================================
posted to pytest-dev/pytest#3470