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/bisectcmd.py b/Lib/test/bisect.py
similarity index 100%
rename from Lib/test/bisectcmd.py
rename to Lib/test/bisect.py
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']:
diff --git a/Lib/test/test_bisect.py b/Lib/test/test_bisect.py
index 5c3330b..9bed28e 100644
--- a/Lib/test/test_bisect.py
+++ b/Lib/test/test_bisect.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
import sys
import unittest
from test import test_support