STINNER Victor added the comment:
Workarounds:
* ./python -m test test_httpservers
* ./python -I Lib/test/test_httpservers.py
> Maybe it's me who is doing things wrong, but when I run
> Lib/test/test_httpservers.py I get this strange error :
...
File "c:\python36\lib\random.py", line 48, in <module>
import bisect as _bisect
File "C:\cpython\Lib\test\bisect.py", line 27, in <module>
...
Oh. Lib/test/ should not be in sys.path. "import bisect" loaded
Lib/test/bisect.py instead of Lib/bisect.py. See my commit
3050987d85d7cf8cdd4b3c053e673d13cd8dfb12 in Python 2.7:
* regrtest now removes '' and Lib/test/ from sys.path
* Use absolute import in test_bisect
(regrtest in master already does something similar.)
But the sys.path is only fixed when regrtest is used...
> There are many ways of running tests, and some of them are broken now.
> $ ./python Lib/test/test_bisect.py
... if you run Lib/test/test_xxx.py directly, Lib/test/ is added to sys.path,
except if you use -I:
$ ./python -I Lib/test/test_bisect.py
....................................
----------------------------------------------------------------------
Ran 36 tests in 0.094s
OK
I didn't know that "./python Lib/test/test_bisect.py" was broken :-(
Maybe Lib/test/support/__init__.py can remove Lib/test/ from sys.path?
Another option is to move or rename Lib/test/bisect.py. For example, replace
"./python -m test.bisect ..." with "./python -m test bisect ..." (or maybe
"./python -m test --bisect ..."). The problem is that bisect has extra options,
but we can add a bisect prefix to these options.
I reopen this issue.
----------
resolution: fixed ->
status: closed -> open
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29512>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com