Skip to content

Commit

Permalink
Add regression test for pytest-dev#2405
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Mar 14, 2018
1 parent 1d240ce commit 7418faf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,3 +964,27 @@ def test2():
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines(['* 2 passed *'])


def test_fixture_order_respects_scope(testdir):
"""Ensure that fixtures are created according to scope order, regression test for #2405
"""
testdir.makepyfile('''
import pytest
data = {}
@pytest.fixture(scope='module')
def clean_data():
data.clear()
@pytest.fixture(autouse=True)
def add_data():
data.update(value=True)
@pytest.mark.usefixtures('clean_data')
def test_value():
assert data.get('value')
''')
result = testdir.runpytest()
assert result.ret == 0

0 comments on commit 7418faf

Please sign in to comment.