-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributortopic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytype: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarification
Description
pytest 3.5.0 on Python 3.6.5 (macOS). This result surprised me:
import pytest
d = {'k': 'v_init'}
@pytest.fixture(autouse=True)
def fixauto(monkeypatch):
monkeypatch.setitem(d, 'k', 'v_auto')
@pytest.fixture
def fix(monkeypatch):
monkeypatch.setitem(d, 'k', 'v_fix')
def test_auto():
assert d['k'] == 'v_auto'
def test_fix(fix):
assert d['k'] == 'v_fix'
def test_fixauto_fix(fixauto, fix):
assert d['k'] == 'v_fix'
def test_fix_fixauto(fix, fixauto):
assert d['k'] == 'v_auto'To be clear, first 3 tests are passing OK but the test_fix_fixauto fails. I would have expected that explicitly injecting an autouse fixture could be used to override the usual order. Feature or bug?
Metadata
Metadata
Assignees
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributortopic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytype: docsdocumentation improvement, missing or needing clarificationdocumentation improvement, missing or needing clarification