pombreda / python-nose

Automatically exported from code.google.com/p/python-nose
0 stars 0 forks source link

Doctests plugin fails in Python 3.1 #391

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install nose with Python 3
2. Run tests that call the doctest plugin (I am using the IPython test suite 
for porting IPython to IPython-py3k.

What is the expected output? What do you see instead?
Error messages "NameError: global name '__builtin__' is not defined"

What version of the product are you using? On what operating system?
Nose 1.0.0 with Python 3.1 on Ubuntu 10.10

Please provide any additional information below.
Replacing the four instances of "__builtin__" with "builtins" resolves the 
issue.

Original issue reported on code.google.com by tak...@gmail.com on 8 Jan 2011 at 8:06

GoogleCodeExporter commented 9 years ago
To clarify, "import __builtin__" is automatically converted by 2to3. But where 
__builtin__ is used in a function, as in "setattr(__builtin__, 
self._result_var, value)", 2to3 doesn't attempt to convert it.

Suggested compatibility shim: "import __builtin__ as builtin_mod", then use 
builtin_mod where "__builtin__" is currently used. I've committed this in my 
own repository if you want to pull from there:
http://code.google.com/r/takowl-python-nose/source/detail?r=7015726b9f8938d5eaad
13225a84df8a20edfcc6

Original comment by tak...@gmail.com on 9 Jan 2011 at 12:35

GoogleCodeExporter commented 9 years ago
Just tested: this passes all tests on Python 2.6* and 3.1.

*There was actually one failure in 2.6:
Failure: twisted.internet.error.DNSLookupError: DNS lookup failed: address 
'nose.python-hosting.com' not found: [Errno -5] No address associated with 
hostname.

But that is down to the domain no longer being resolvable. I have updated this 
in a further commit, after which all tests pass.

Original comment by tak...@gmail.com on 14 Jan 2011 at 10:41

GoogleCodeExporter commented 9 years ago

Original comment by jpelle...@gmail.com on 15 Jan 2011 at 4:43

GoogleCodeExporter commented 9 years ago

Original comment by jpelle...@gmail.com on 20 Jan 2011 at 2:16

GoogleCodeExporter commented 9 years ago

Original comment by jpelle...@gmail.com on 20 Jan 2011 at 2:18