]> granicus.if.org Git - python/commitdiff
bpo-30843: regrtest fixes sys.path, restore test.bisect (#2567)
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 5 Jul 2017 07:16:47 +0000 (09:16 +0200)
committerGitHub <noreply@github.com>
Wed, 5 Jul 2017 07:16:47 +0000 (09:16 +0200)
* 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

Lib/test/bisect.py [moved from Lib/test/bisectcmd.py with 100% similarity]
Lib/test/regrtest.py
Lib/test/test_bisect.py

similarity index 100%
rename from Lib/test/bisectcmd.py
rename to Lib/test/bisect.py
index 925b7dba1702db5c79061b03a93fc951a3ad2985..1290086cc0b457625eb9b60bfa6a20b8a5714bb3 100755 (executable)
@@ -464,6 +464,14 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
         # 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']:
index 5c3330b4e410f7ba7f416b009e6a488884670579..9bed28e058c95634aa4c1b6382615cdb4abca39e 100644 (file)
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
 import sys
 import unittest
 from test import test_support