
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2018-12-17 11:35 byvajrasky, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11200 | merged | vstinner,2018-12-17 15:44 | |
| PR 11202 | merged | miss-islington,2018-12-17 21:06 | |
| Messages (7) | |||
|---|---|---|---|
| msg331992 -(view) | Author: Vajrasky Kok (vajrasky)* | Date: 2018-12-17 11:35 | |
$ git clonegit@github.com:python/cpython.git cpython2$ cd cpython2$ ./configure --with-pydebug$ make -j$ ./pythonLib/test/test_xmlrpc.py Traceback (most recent call last): File "Lib/test/test_xmlrpc.py", line 8, in <module> import xmlrpc.client as xmlrpclib File "/opt/Code/python/cpython2/Lib/xmlrpc/client.py", line 136, in <module> import http.client File "/opt/Code/python/cpython2/Lib/http/client.py", line 71, in <module> import email.parser File "/opt/Code/python/cpython2/Lib/email/parser.py", line 12, in <module> from email.feedparser import FeedParser, BytesFeedParser File "/opt/Code/python/cpython2/Lib/email/feedparser.py", line 27, in <module> from email._policybase import compat32 File "/opt/Code/python/cpython2/Lib/email/_policybase.py", line 9, in <module> from email.utils import _has_surrogates File "/opt/Code/python/cpython2/Lib/email/utils.py", line 28, in <module> import random File "/opt/Code/python/cpython2/Lib/random.py", line 47, in <module> import bisect as _bisect File "/opt/Code/python/cpython2/Lib/test/bisect.py", line 27, in <module> import tempfile File "/opt/Code/python/cpython2/Lib/tempfile.py", line 45, in <module> from random import Random as _RandomImportError: cannot import name 'Random' from 'random' (/opt/Code/python/cpython2/Lib/random.py)I know about running test this way:$ ./python -m test -v test_xmlrpcAnd it works.I am just wondering whether I should be able to run test this way: ./pythonLib/test/test_blabla.py?Because running other tests without test module works, for example: ./pythonLib/test/test_ast.py. Only test which imports random module fails. | |||
| msg331993 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-12-17 11:39 | |
Your problem is that you have theLib/test/bisect.py file. I renamed it toLib/test/bisect_cmd.py.Workarounds:* Run the test using: ./python -m test test_xmlrpc* RenameLib/test/bisect.py toLib/test/bisect_cmd.pyThis bug is already fixed in the 2.7. You have to wait for the next 2.7 release to get the fix. | |||
| msg332002 -(view) | Author: Vajrasky Kok (vajrasky)* | Date: 2018-12-17 13:13 | |
Okay, thanks, Victor. Your suggestion to renameLib/test/bisect.py toLib/test/bisect_cmd.py works. My question is why you fixed in 2.7 branch only? This problem persists in master (3.8).Ah, I think because I use cpython2 directory name, you thought I used Python 2. cpython2 is just a directory name. It has nothing to do with Python 2. I used master when finding this bug. | |||
| msg332012 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-12-17 15:40 | |
> Ah, I think because I use cpython2 directory name, you thought I used Python 2. cpython2 is just a directory name. It has nothing to do with Python 2. I used master when finding this bug.Ah right, I can reproduce the issue in master:vstinner@apu$ ./pythonLib/test/test_xmlrpc.py Traceback (most recent call last): File "Lib/test/test_xmlrpc.py", line 8, in <module> import xmlrpc.client as xmlrpclib File "/home/vstinner/prog/python/master/Lib/xmlrpc/client.py", line 136, in <module> import http.client File "/home/vstinner/prog/python/master/Lib/http/client.py", line 71, in <module> import email.parser File "/home/vstinner/prog/python/master/Lib/email/parser.py", line 12, in <module> from email.feedparser import FeedParser, BytesFeedParser File "/home/vstinner/prog/python/master/Lib/email/feedparser.py", line 27, in <module> from email._policybase import compat32 File "/home/vstinner/prog/python/master/Lib/email/_policybase.py", line 9, in <module> from email.utils import _has_surrogates File "/home/vstinner/prog/python/master/Lib/email/utils.py", line 28, in <module> import random File "/home/vstinner/prog/python/master/Lib/random.py", line 47, in <module> import bisect as _bisect File "/home/vstinner/prog/python/master/Lib/test/bisect.py", line 27, in <module> import tempfile File "/home/vstinner/prog/python/master/Lib/tempfile.py", line 45, in <module> from random import Random as _RandomImportError: cannot import name 'Random' from 'random' (/home/vstinner/prog/python/master/Lib/random.py)Hum. We should either renameLib/test/bisect.py toLib/test/bisect_cmd.py or move the feature into libregrtest. | |||
| msg332022 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-12-17 21:06 | |
New changeset1dd035954bb03c41b954ebbd63969b4bcb0e106e by Victor Stinner in branch 'master':bpo-35519: Rename test.bisect to test.bisect_cmd (GH-11200)https://github.com/python/cpython/commit/1dd035954bb03c41b954ebbd63969b4bcb0e106e | |||
| msg332026 -(view) | Author: miss-islington (miss-islington) | Date: 2018-12-17 21:24 | |
New changeset05dfa0cc96f6b72b1e72f57b1b5f4b37764a382d by Miss Islington (bot) in branch '3.7':bpo-35519: Rename test.bisect to test.bisect_cmd (GH-11200)https://github.com/python/cpython/commit/05dfa0cc96f6b72b1e72f57b1b5f4b37764a382d | |||
| msg332027 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2018-12-17 21:38 | |
I renamedLib/test/bisect.py toLib/test/bisect_cmd.py ;-) | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:09 | admin | set | github: 79700 |
| 2018-12-17 21:38:27 | vstinner | set | status: open -> closed versions: + Python 3.7, Python 3.8 messages: +msg332027 resolution: fixed stage: patch review -> resolved |
| 2018-12-17 21:24:56 | miss-islington | set | nosy: +miss-islington messages: +msg332026 |
| 2018-12-17 21:06:26 | miss-islington | set | pull_requests: +pull_request10440 |
| 2018-12-17 21:06:13 | vstinner | set | messages: +msg332022 |
| 2018-12-17 15:44:12 | vstinner | set | keywords: +patch stage: resolved -> patch review pull_requests: +pull_request10439 |
| 2018-12-17 15:40:17 | vstinner | set | title: [2.7] Can not run test without test module for tests which import random module -> Can not run test without test module for tests which import random module |
| 2018-12-17 15:40:12 | vstinner | set | status: closed -> open nosy: +pablogsal messages: +msg332012 resolution: fixed -> (no value) |
| 2018-12-17 13:13:04 | vajrasky | set | messages: +msg332002 |
| 2018-12-17 11:39:40 | vstinner | set | status: open -> closed title: Can not run test without test module for tests which import random module -> [2.7] Can not run test without test module for tests which import random module nosy: +vstinner versions: + Python 2.7, - Python 3.8 messages: +msg331993 resolution: fixed stage: resolved |
| 2018-12-17 11:35:16 | vajrasky | create | |