From f19db07c43f745ba6af83c6b61ce7f85d149827c Mon Sep 17 00:00:00 2001
From: Stefan Behnel <stefan_ml@behnel.de>
Date: Fri, 10 Apr 2020 12:04:44 +0200
Subject: [PATCH] For srctree tests, include the test directory in the
 PYTHONPATH of subprocesses, but not in the own sys.path of the test runner.

---
 runtests.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/runtests.py b/runtests.py
index c30b08132..e3d7116eb 100755
--- a/runtests.py
+++ b/runtests.py
@@ -1738,8 +1738,6 @@ class EndToEndTest(unittest.TestCase):
         _, self.commands = unpack_source_tree(self.treefile, self.workdir, self.cython_root)
         self.old_dir = os.getcwd()
         os.chdir(self.workdir)
-        if self.workdir not in sys.path:
-            sys.path.insert(0, self.workdir)
 
     def tearDown(self):
         if self.cleanup_workdir:
@@ -1764,7 +1762,7 @@ class EndToEndTest(unittest.TestCase):
         env = dict(os.environ)
         new_path = self.cython_syspath
         if old_path:
-            new_path = new_path + os.pathsep + old_path
+            new_path = new_path + os.pathsep + self.workdir + os.pathsep + old_path
         env['PYTHONPATH'] = new_path
         if not env.get("PYTHONIOENCODING"):
             env["PYTHONIOENCODING"] = sys.stdout.encoding or sys.getdefaultencoding()
-- 
2.30.9