-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with i18n , gettext and the "_" function #393
Comments
|
Extra note: We don't need a final solution, a workaround could be enough for now :) Google Code Info: |
|
Any comments about this issue? Google Code Info: |
|
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(): Google Code Info: |
|
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? Google Code Info: |
|
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 Putting the below code in /src/project/init.py did not work, however putting it in /src/tests/init.py did work... import builtin If I put the above inside a setup or setUpProject function, it does NOT work. Just a heads up. Cheers, Google Code Info: |
What steps will reproduce the problem?
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:
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:
The text was updated successfully, but these errors were encountered: