def test_initial_conftests_with_testpaths(pytester: Pytester) -> None:
    """The testpaths ini option should load conftests in those paths as 'initial' (#10987)."""
    p = pytester.mkdir("some_path")
    p.joinpath("conftest.py").write_text(
        textwrap.dedent(
            """
            def pytest_sessionstart(session):
                raise Exception("pytest_sessionstart hook successfully run")
            """
        ),
        encoding="utf-8",
    )
    pytester.makeini(
        """
        [pytest]
        testpaths = some_path
        """
    )

    # No command line args - falls back to testpaths.
    result = pytester.runpytest()
    assert result.ret == ExitCode.INTERNAL_ERROR
    result.stdout.fnmatch_lines(
        "INTERNALERROR* Exception: pytest_sessionstart hook successfully run"
    )

    # No fallback.
    result = pytester.runpytest(".")
    assert result.ret == ExitCode.NO_TESTS_COLLECTED
The testpaths ini option should load conftests in those paths as 'initial' (#10987).
testing/test_collection.py