pytest-parallel icon indicating copy to clipboard operation
pytest-parallel copied to clipboard

fixture will be repeated with the case use pytest.mark.parametrize

Open Guanyan1996 opened this issue 6 years ago • 2 comments

`import pytest

@pytest.fixture(scope='module') def a(): a = 'nihao' print('初始化') return a

@pytest.mark.parametrize('data',['a','b','c']) def test_001(a,data): print(a,data)`

this code ,the fixture will be used three times when I use the pytest-parallel

if i don't use pytest-parallel,only once.

Guanyan1996 avatar Jun 12 '19 09:06 Guanyan1996

This is not a bug. Kindly proceed to pytest documentation -> https://pytest.readthedocs.io/en/2.8.7/parametrize.html

psdon avatar Jun 27 '19 23:06 psdon

This is not a bug. Kindly proceed to pytest documentation -> https://pytest.readthedocs.io/en/2.8.7/parametrize.html

I went over the link and did not see how does it answer the question. Can you be more specific as to why the fixture scope is not honored when using pytest-parallel?

pksol avatar Aug 31 '20 13:08 pksol