#12910 closed (fixed)
xgettext now required to run tests
Reported by: | Karen Tracey | Owned by: | Jannis Leidel |
---|---|---|---|
Component: | Uncategorized | Version: | 1.1 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Attempting to run tests on a Windows machine with no xgettext package install now dies a horrible death. The failure to find an xgettext executable causes the whole test run to just quit:
Installed 62 object(s) from 5 fixture(s) ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Error: errors happened while running xgettext on __init__.py 'xgettext' is not recognized as an internal or external command, operable program or batch file. C:\u\kmt\django\trunk\tests>
I think we need to somehow figure out if xgettext is available and if not, skip running tests that require it.
Attachments (1)
Change History (9)
follow-up: 2 comment:1 by , 15 years ago
follow-up: 4 comment:2 by , 15 years ago
Replying to jezdez:
Hm, does that only occur for Django's tests or for app tests as well?
I suspect it is just the Django test suite with our new makemessages regression test. I can reproduce this by just running it (it seems there are other test failures when xgettext.exe
does exist too).
And I suspect it could be related to this:
- No gettext? If you don't have the gettext utilities installed, django-admin.py makemessages will create empty files. If that's the case, either install the gettext utilities or just copy the English message file (locale/en/LC_MESSAGES/django.po) if available and use it as a starting point; it's just an empty translation file. (from http://docs.djangoproject.com/en/dev/topics/i18n/localization/#topics-i18n-localization)
- Note: All [os.popen*] functions in this section fail (more or less) silently if the executed program cannot be found; this [subprocess] module raises an OSError exception. (from http://docs.python.org/library/subprocess.html#replacing-older-functions-with-the-subprocess-module).
Summary: The old os.popen3
simply ignored the condition of a missing xgettext
(or msgmerge
or msgfmt
) and we used that to our advantage (creating an empty .po
file). Now subprocess.Popen()
raises an OSError
exception instead.
I had seen this and made a mental note about testing this under win32, but forgot to do it later.
Problem was I couldn't get Popen()
to raise that OSError
under Linux when trying to execute a non-existing external command (e.g. Popen('foo', shell=True, stdout=PIPE, stderr=PIPE, close_fds=False, universal_newlines=True).communicate()
)
comment:3 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 15 years ago
Replying to ramiro:
Replying to jezdez:
Hm, does that only occur for Django's tests or for app tests as well?
I suspect it is just the Django test suite with our new makemessages regression test. I can reproduce this by just running it (it seems there are other test failures when
xgettext.exe
does exist too).
Russ and me we thinking about making the makemessages tests optional just like we do with YAML tests for example, e.g. by a conditional import in the makemessages/tests.py if a call to xgettext succeeds.
And I suspect it could be related to this:
- No gettext? If you don't have the gettext utilities installed, django-admin.py makemessages will create empty files. If that's the case, either install the gettext utilities or just copy the English message file (locale/en/LC_MESSAGES/django.po) if available and use it as a starting point; it's just an empty translation file. (from http://docs.djangoproject.com/en/dev/topics/i18n/localization/#topics-i18n-localization)
- Note: All [os.popen*] functions in this section fail (more or less) silently if the executed program cannot be found; this [subprocess] module raises an OSError exception. (from http://docs.python.org/library/subprocess.html#replacing-older-functions-with-the-subprocess-module).
Summary: The old
os.popen3
simply ignored the condition of a missingxgettext
(ormsgmerge
ormsgfmt
) and we used that to our advantage (creating an empty.po
file). Nowsubprocess.Popen()
raises anOSError
exception instead.
I had seen this and made a mental note about testing this under win32, but forgot to do it later.
Problem was I couldn't get
Popen()
to raise thatOSError
under Linux when trying to execute a non-existing external command (e.g.Popen('foo', shell=True, stdout=PIPE, stderr=PIPE, close_fds=False, universal_newlines=True).communicate()
)
Oddly enough Popen()
will only raise the OSError for me if I pass it
shell=False
.
by , 15 years ago
Attachment: | 12910.1.diff added |
---|
Patch to only perform extraction tests if xgettext is found in PATH.
comment:5 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Hm, does that only occur for Django's tests or for app tests as well?