bpo-30843: regrtest fixes sys.path, restore test.bisect (#2567)
* Rename again Lib/test/bisectcmd.py to Lib/test/bisect.py
* regrtest now removes '' and Lib/test/ from sys.path
* Use absolute import in test_bisect
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 925b7db..1290086 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -464,6 +464,14 @@
# to locate tests
sys.path.insert(0, testdir)
+ # Make sure that '' and Lib/test/ are not in sys.path
+ regrtest_dir = os.path.abspath(os.path.dirname(__file__))
+ for path in ('', regrtest_dir):
+ try:
+ sys.path.remove(path)
+ except ValueError:
+ pass
+
if slaveargs is not None:
args, kwargs = json.loads(slaveargs)
if kwargs['huntrleaks']: