def test_collect_duplicate_names(self, pytester: Pytester) -> None:
        """--import-mode=importlib can import modules with same names that are not in packages."""
        pytester.makepyfile(
            **{
                "tests_a/test_foo.py": "def test_foo1(): pass",
                "tests_b/test_foo.py": "def test_foo2(): pass",
            }
        )
        result = pytester.runpytest("-v", "--import-mode=importlib")
        result.stdout.fnmatch_lines(
            [
                "tests_a/test_foo.py::test_foo1 *",
                "tests_b/test_foo.py::test_foo2 *",
                "* 2 passed in *",
            ]
        )
--import-mode=importlib can import modules with same names that are not in packages.
testing/test_collection.py