Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue35519

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Can not run test without test module for tests which import random module
Type:Stage:resolved
Components:TestsVersions:Python 3.8, Python 3.7, Python 2.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: miss-islington, pablogsal, vajrasky, vstinner
Priority:normalKeywords:patch

Created on2018-12-17 11:35 byvajrasky, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 11200mergedvstinner,2018-12-17 15:44
PR 11202mergedmiss-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)*(Python committer)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)*(Python committer)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)*(Python committer)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)*(Python committer)Date: 2018-12-17 21:38
I renamedLib/test/bisect.py toLib/test/bisect_cmd.py ;-)
History
DateUserActionArgs
2022-04-11 14:59:09adminsetgithub: 79700
2018-12-17 21:38:27vstinnersetstatus: open -> closed
versions: + Python 3.7, Python 3.8
messages: +msg332027

resolution: fixed
stage: patch review -> resolved
2018-12-17 21:24:56miss-islingtonsetnosy: +miss-islington
messages: +msg332026
2018-12-17 21:06:26miss-islingtonsetpull_requests: +pull_request10440
2018-12-17 21:06:13vstinnersetmessages: +msg332022
2018-12-17 15:44:12vstinnersetkeywords: +patch
stage: resolved -> patch review
pull_requests: +pull_request10439
2018-12-17 15:40:17vstinnersettitle: [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:12vstinnersetstatus: closed -> open

nosy: +pablogsal
messages: +msg332012

resolution: fixed -> (no value)
2018-12-17 13:13:04vajraskysetmessages: +msg332002
2018-12-17 11:39:40vstinnersetstatus: 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:16vajraskycreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp