Add failing test
This commit is contained in:
parent
4cb60dac3d
commit
29fa9d5bff
|
@ -2,6 +2,7 @@ from __future__ import absolute_import, division, print_function
|
||||||
import pytest
|
import pytest
|
||||||
import py
|
import py
|
||||||
|
|
||||||
|
import _pytest._code
|
||||||
from _pytest.main import Session, EXIT_NOTESTSCOLLECTED, _in_venv
|
from _pytest.main import Session, EXIT_NOTESTSCOLLECTED, _in_venv
|
||||||
|
|
||||||
|
|
||||||
|
@ -830,3 +831,28 @@ def test_continue_on_collection_errors_maxfail(testdir):
|
||||||
"*Interrupted: stopping after 3 failures*",
|
"*Interrupted: stopping after 3 failures*",
|
||||||
"*1 failed, 2 error*",
|
"*1 failed, 2 error*",
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
def test_fixture_scope_sibling_conftests(testdir):
|
||||||
|
"""Regression test case for https://github.com/pytest-dev/pytest/issues/2836"""
|
||||||
|
foo_path = testdir.mkpydir("foo")
|
||||||
|
foo_path.join("conftest.py").write(_pytest._code.Source("""
|
||||||
|
import pytest
|
||||||
|
@pytest.fixture
|
||||||
|
def fix():
|
||||||
|
return 1
|
||||||
|
"""))
|
||||||
|
foo_path.join("test_foo.py").write("def test_foo(fix): assert fix == 1")
|
||||||
|
|
||||||
|
# Tests in `food/` should not see the conftest fixture from `foo/`
|
||||||
|
food_path = testdir.mkpydir("food")
|
||||||
|
food_path.join("test_food.py").write("def test_food(fix): assert fix == 1")
|
||||||
|
|
||||||
|
res = testdir.runpytest()
|
||||||
|
assert res.ret == 1
|
||||||
|
|
||||||
|
# TODO Work out what this will really look like. Currently the retcode assertion above fails (as expected).
|
||||||
|
res.stdout.fnmatch_lines([
|
||||||
|
"collected 2 items / 1 errors",
|
||||||
|
"*1 passed, 1 error*",
|
||||||
|
])
|
||||||
|
|
Loading…
Reference in New Issue