We set PYTHONPATH during testing. --- coverage-7.10.4/tests/coveragetest.py.orig +++ coverage-7.10.4/tests/coveragetest.py @@ -475,11 +475,9 @@ def add_test_modules_to_pythonpath(self) -> None: """Add our test modules directory to PYTHONPATH.""" - # Check that there isn't already a PYTHONPATH. - assert os.getenv("PYTHONPATH") is None testmods = nice_file(self.working_root(), "tests/modules") zipfile = nice_file(self.working_root(), "tests/zipmods.zip") - self.set_environ("PYTHONPATH", testmods + os.pathsep + zipfile) + self.set_environ("PYTHONPATH", os.getenv("PYTHONPATH") + os.pathsep + testmods + os.pathsep + zipfile) def working_root(self) -> str: """Where is the root of the coverage.py working tree?"""