File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ Dave Hunt
34
34
David Díaz-Barquero
35
35
David Mohr
36
36
David Vierra
37
+ Diego Russo
37
38
Edison Gustavo Muenz
38
39
Eduardo Schettino
39
40
Elizaveta Shashkova
Original file line number Diff line number Diff line change @@ -336,6 +336,38 @@ def test_spam(spam):
336
336
result = testdir .runpytest (testfile )
337
337
result .stdout .fnmatch_lines (["*3 passed*" ])
338
338
339
+ def test_override_autouse_fixture_with_parametrized_fixture_conftest_conftest (self , testdir ):
340
+ """Test override of the autouse fixture with parametrized one on the conftest level.
341
+ This test covers the issue explained in issue 1601
342
+ """
343
+ testdir .makeconftest ("""
344
+ import pytest
345
+
346
+ @pytest.fixture(autouse=True)
347
+ def spam():
348
+ return 'spam'
349
+ """ )
350
+ subdir = testdir .mkpydir ('subdir' )
351
+ subdir .join ("conftest.py" ).write (_pytest ._code .Source ("""
352
+ import pytest
353
+
354
+ @pytest.fixture(params=[1, 2, 3])
355
+ def spam(request):
356
+ return request.param
357
+ """ ))
358
+ testfile = subdir .join ("test_spam.py" )
359
+ testfile .write (_pytest ._code .Source ("""
360
+ params = {'spam': 1}
361
+
362
+ def test_spam(spam):
363
+ assert spam == params['spam']
364
+ params['spam'] += 1
365
+ """ ))
366
+ result = testdir .runpytest ()
367
+ result .stdout .fnmatch_lines (["*3 passed*" ])
368
+ result = testdir .runpytest (testfile )
369
+ result .stdout .fnmatch_lines (["*3 passed*" ])
370
+
339
371
def test_autouse_fixture_plugin (self , testdir ):
340
372
# A fixture from a plugin has no baseid set, which screwed up
341
373
# the autouse fixture handling.
You can’t perform that action at this time.
0 commit comments