def test_fixture_scope_sibling_conftests(pytester: Pytester) -> None:
    """Regression test case for https://github.com/pytest-dev/pytest/issues/2836"""
    foo_path = pytester.mkdir("foo")
    foo_path.joinpath("conftest.py").write_text(
        textwrap.dedent(
            """\
            import pytest
            @pytest.fixture
            def fix():
                return 1
            """
        ),
        encoding="utf-8",
    )
    foo_path.joinpath("test_foo.py").write_text(
        "def test_foo(fix): assert fix == 1", encoding="utf-8"
    )

    # Tests in `food/` should not see the conftest fixture from `foo/`
    food_path = pytester.mkpydir("food")
    food_path.joinpath("test_food.py").write_text(
        "def test_food(fix): assert fix == 1", encoding="utf-8"
    )

    res = pytester.runpytest()
    assert res.ret == 1

    res.stdout.fnmatch_lines(
        [
            "*ERROR at setup of test_food*",
            "E*fixture 'fix' not found",
            "*1 passed, 1 error*",
        ]
    )
Regression test case for https://github.com/pytest-dev/pytest/issues/2836
testing/test_collection.py