Message299047
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. |
|
Date |
User |
Action |
Args |
2017-07-25 09:07:26 | vstinner | set | recipients:
+ vstinner, quentel, serhiy.storchaka, yselivanov |
2017-07-25 09:07:26 | vstinner | set | messageid: <1500973646.36.0.201073519509.issue29512@psf.upfronthosting.co.za> |
2017-07-25 09:07:26 | vstinner | link | issue29512 messages |
2017-07-25 09:07:26 | vstinner | create | |
|