[Python-Dev] New work-in-progress bisection tool for the Python test suite (in regrtest)

Victor Stinner victor.stinner at gmail.com
Tue Jul 4 07:03:26 EDT 2017


2017-07-04 12:52 GMT+02:00 Nick Coghlan <ncoghlan at gmail.com>:
> I know it's longer, but perhaps it would make sense to put the
> bisection helper under "python -m test.support.bisect" in both Python
> 2 & 3?

For me, test.support is a toolkit to *write* tests, not really to run tests.

I don't really care where my bisect tool lives. Serhiy proposed
test.bisect, I like because it's short and easy to remind.

Technically it is possible to get test.bisect on Python 2, it just
requires to modify 4 .py files which import Lib/bisect.py to add "from
__future__ import absolute_import":

Lib/urllib2.py:import bisect
Lib/mhlib.py:from bisect import bisect
Lib/test/test_bisect.py:import bisect as py_bisect
Lib/multiprocessing/heap.py:import bisect

I modified Lib/test/test_bisect.py, but I missed these other ones in
my first commit. And then I got a failure in multiprocessing.

I chose the conservative approach: rename the new Lib/test/bisect.py file.

Do you prefer to get test.bisect, and so modify the 4 files to add
"from __future__ import absolute_import"?

I didn't recall the subtle details of "relative import" in Python 2.
Since I'm now used to Python 3, the Python 2 behaviour now really
looks weird to me :-)

Victor


More information about the Python-Dev mailing list