def create_installed_doctests_and_tests_dir(
        self, path: Path, monkeypatch: MonkeyPatch
    ) -> tuple[Path, Path, Path]:
        """
        Create a directory structure where the application code is installed in a virtual environment,
        and the tests are in an outside ".tests" directory.

        Return the paths to the core module (installed in the virtualenv), and the test modules.
        """
        app = path / "src/app"
        app.mkdir(parents=True)
        (app / "__init__.py").touch()
        core_py = app / "core.py"
        core_py.write_text(
            dedent(
                """
                def foo():
                    '''
                    >>> 1 + 1
                    2
                    '''
                """
            ),
            encoding="ascii",
        )

        # Install it into a site-packages directory, and add it to sys.path, mimicking what
        # happens when installing into a virtualenv.
        site_packages = path / ".env/lib/site-packages"
        site_packages.mkdir(parents=True)
        shutil.copytree(app, site_packages / "app")
        assert (site_packages / "app/core.py").is_file()

        monkeypatch.syspath_prepend(site_packages)

        # Create the tests files, outside 'src' and the virtualenv.
        # We use the same test name on purpose, but in different directories, to ensure
        # this works as advertised.
        conftest_path1 = path / ".tests/a/conftest.py"
        conftest_path1.parent.mkdir(parents=True)
        conftest_path1.write_text(
            dedent(
                """
                import pytest
                @pytest.fixture
                def a_fix(): return "a"
                """
            ),
            encoding="ascii",
        )
        test_path1 = path / ".tests/a/test_core.py"
        test_path1.write_text(
            dedent(
                """
                import app.core
                def test(a_fix):
                    assert a_fix == "a"
                """,
            ),
            encoding="ascii",
        )

        conftest_path2 = path / ".tests/b/conftest.py"
        conftest_path2.parent.mkdir(parents=True)
        conftest_path2.write_text(
            dedent(
                """
                import pytest
                @pytest.fixture
                def b_fix(): return "b"
                """
            ),
            encoding="ascii",
        )

        test_path2 = path / ".tests/b/test_core.py"
        test_path2.write_text(
            dedent(
                """
                import app.core
                def test(b_fix):
                    assert b_fix == "b"
                """,
            ),
            encoding="ascii",
        )
        return (site_packages / "app/core.py"), test_path1, test_path2

        Create a directory structure where the application code is installed in a virtual environment,
        and the tests are in an outside ".tests" directory.

        Return the paths to the core module (installed in the virtualenv), and the test modules.
        
testing/test_pathlib.py