[New-bugs-announce] [issue35519] Can not run test without test module for tests which import random module

Vajrasky Kok report at bugs.python.org
Mon Dec 17 06:35:16 EST 2018


New submission from Vajrasky Kok <sky.kok at speaklikeaking.com>:

$ git clone git at github.com:python/cpython.git cpython2
$ cd cpython2
$ ./configure --with-pydebug
$ make -j
$ ./python Lib/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 _Random
ImportError: 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_xmlrpc

And it works.

I am just wondering whether I should be able to run test this way: ./python Lib/test/test_blabla.py?

Because running other tests without test module works, for example: ./python Lib/test/test_ast.py. Only test which imports random module fails.

----------
components: Tests
messages: 331992
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Can not run test without test module for tests which import random module
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35519>
_______________________________________


More information about the New-bugs-announce mailing list