Open GoogleCodeExporter opened 8 years ago
Extra note: We don't need a final solution, a workaround could be enough for
now :)
Original comment by andres.riancho@gmail.com
on 9 Nov 2010 at 3:13
Any comments about this issue?
Original comment by andres.riancho@gmail.com
on 12 Nov 2010 at 11:18
Fixed by adding this code to the "__init__.py" file of the package that was
raising all those errors:
"""
# Intended to be called by nose.
def setUpPackage():
# Hack to init i18n function
import __builtins__
__builtins__.__dict__['_'] = lambda x: x
"""
Original comment by andres.riancho@gmail.com
on 30 Nov 2010 at 5:13
Andres, your fix did not work for me. First, there is a typo... it's
__builtin__, not __builtins__, but even after making that fix, I still get the
same NameError: name '_' is not defined message when running nosetests.
Any thoughts or ideas?
Original comment by jaypi...@gmail.com
on 10 Dec 2010 at 4:24
Following up, I was able to get nosetests to work using the following in a
/tests/__init__.py file where tests/ contains all the test case files.
My project is structured like so:
/src
/project
/tests
Putting the below code in /src/project/__init__.py did not work, however
putting it in /src/tests/__init__.py did work...
import __builtin__
setattr(__builtin__, '_', lambda x: x)
If I put the above inside a setup or setUpProject function, it does NOT work.
Just a heads up.
Cheers,
jay
Original comment by jaypi...@gmail.com
on 10 Dec 2010 at 4:55
Original issue reported on code.google.com by
andres.riancho@gmail.com
on 9 Nov 2010 at 3:09