This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients quentel, serhiy.storchaka, vstinner, yselivanov
Date 2017-07-25.09:07:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>

* ./python -m test test_httpservers
* ./python -I Lib/test/

> Maybe it's me who is doing things wrong, but when I run Lib/test/ I get this strange error :

  File "c:\python36\lib\", line 48, in <module>
    import bisect as _bisect
  File "C:\cpython\Lib\test\", line 27, in <module>

Oh. Lib/test/ should not be in sys.path. "import bisect" loaded Lib/test/ instead of Lib/ 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/

... if you run Lib/test/ directly, Lib/test/ is added to sys.path, except if you use -I:

$ ./python -I Lib/test/ 
Ran 36 tests in 0.094s


I didn't know that "./python Lib/test/" was broken :-(

Maybe Lib/test/support/ can remove Lib/test/ from sys.path?

Another option is to move or rename Lib/test/ 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:26vstinnersetrecipients: + vstinner, quentel, serhiy.storchaka, yselivanov
2017-07-25 09:07:26vstinnersetmessageid: <>
2017-07-25 09:07:26vstinnerlinkissue29512 messages
2017-07-25 09:07:26vstinnercreate