nose-devs/nose — Issue #393: Problems with i18n , gettext and the "_" function
Author: jpellerin
Created: 2011-12-14 16:09:45+00:00
State: open

What steps will reproduce the problem?
1. Download w3af's source code
2. Run nosetests --rednose --with-doctest --doctest-tests -e 'extlib.*'

What is the expected output? What do you see instead?
I expect nose to run the different modules and show the tests that failed, instead I'm getting:

-----------------------------------------------------------------------------
17) ERROR: Failure: NameError (name '_' is not defined)

Traceback (most recent call last):
/usr/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/loader.py line 382 in loadTestsFromName
addr.filename, addr.module)
/usr/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/importer.py line 39 in importFromPath
return self.importFromDir(dir_path, fqname)
/usr/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/importer.py line 86 in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
core/ui/gtkUi/reqResViewer.py line 43 in
from .export_request import export_request
core/ui/gtkUi/export_request.py line 25 in
from .encdec import SimpleTextView
core/ui/gtkUi/encdec.py line 502 in
(_("URL Encode"), urlencode),
NameError: name '_' is not defined

These errors are generated because my tool has some i18n features. These features are added with the gettext module. This module adds the "_" function to globals when I run this in the init script:

# Translation stuff
gettext.install('w3af', 'locales/')

The "_" is defined at runtime, and nose is not being able to handle that.

What version of the product are you using? On what operating system?
Latest version, with the rednose plugin installed.
Ubuntu 8.04.
Python 2.5.2

Please provide any additional information below.
Feel free to contact me via email (andres.riancho !at! gmail . com)

Google Code Info:
Issue #: 373
Author: andres.riancho@gmail.com
Created On: 2010-11-09T15:09:22.000Z
Closed On: