[issue35519] [2.7] Can not run test without test module for tests which import random module

2018-12-17 Thread STINNER Victor


STINNER Victor  added the comment:

> 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$ ./python Lib/test/test_xmlrpc.py 
Traceback (most recent call last):
  File "Lib/test/test_xmlrpc.py", line 8, in 
import xmlrpc.client as xmlrpclib
  File "/home/vstinner/prog/python/master/Lib/xmlrpc/client.py", line 136, in 

import http.client
  File "/home/vstinner/prog/python/master/Lib/http/client.py", line 71, in 

import email.parser
  File "/home/vstinner/prog/python/master/Lib/email/parser.py", line 12, in 

from email.feedparser import FeedParser, BytesFeedParser
  File "/home/vstinner/prog/python/master/Lib/email/feedparser.py", line 27, in 

from email._policybase import compat32
  File "/home/vstinner/prog/python/master/Lib/email/_policybase.py", line 9, in 

from email.utils import _has_surrogates
  File "/home/vstinner/prog/python/master/Lib/email/utils.py", line 28, in 

import random
  File "/home/vstinner/prog/python/master/Lib/random.py", line 47, in 
import bisect as _bisect
  File "/home/vstinner/prog/python/master/Lib/test/bisect.py", line 27, in 

import tempfile
  File "/home/vstinner/prog/python/master/Lib/tempfile.py", line 45, in 
from random import Random as _Random
ImportError: cannot import name 'Random' from 'random' 
(/home/vstinner/prog/python/master/Lib/random.py)

Hum. We should either rename Lib/test/bisect.py to Lib/test/bisect_cmd.py or 
move the feature into libregrtest.

--
nosy: +pablogsal
resolution: fixed -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35519] [2.7] Can not run test without test module for tests which import random module

2018-12-17 Thread Vajrasky Kok


Vajrasky Kok  added the comment:

Okay, thanks, Victor. Your suggestion to rename Lib/test/bisect.py to 
Lib/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.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35519] [2.7] Can not run test without test module for tests which import random module

2018-12-17 Thread STINNER Victor


STINNER Victor  added the comment:

Your problem is that you have the Lib/test/bisect.py file. I renamed it to 
Lib/test/bisect_cmd.py.

Workarounds:

* Run the test using: ./python -m test test_xmlrpc
* Rename Lib/test/bisect.py to Lib/test/bisect_cmd.py

This bug is already fixed in the 2.7. You have to wait for the next 2.7 release 
to get the fix.

--
nosy: +vstinner
resolution:  -> fixed
stage:  -> resolved
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
versions: +Python 2.7 -Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com