From: Victor Stinner Date: Wed, 5 Jul 2017 07:16:47 +0000 (+0200) Subject: bpo-30843: regrtest fixes sys.path, restore test.bisect (#2567) X-Git-Tag: v2.7.14rc1~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3050987d85d7cf8cdd4b3c053e673d13cd8dfb12;p=python 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 925b7dba17..1290086cc0 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -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']: diff --git a/Lib/test/test_bisect.py b/Lib/test/test_bisect.py index 5c3330b4e4..9bed28e058 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