#26232: i18n unit test fails on xgettext in /usr/local/bin
-----------------------------------+--------------------
     Reporter:  jeroenp            |      Owner:  nobody
         Type:  Bug                |     Status:  new
    Component:  Testing framework  |    Version:  master
     Severity:  Normal             |   Keywords:
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+--------------------
 The test_compilation unit test sets a very minimalist environment so that
 the unit test fails to find xgettext in /usr/local/bin (homebrew on mac,
 anyone?).

 {{{
 ======================================================================
 [51/291]
 ERROR: test_msgfmt_error_including_non_ascii
 (i18n.test_compilation.CompilationErrorHandling$
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.
 5/unittest/case.py", line 58, in testPartExecutor
     yield
   File
 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.
 5/unittest/case.py", line 600, in run
     testMethod()
   File
 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.
 5/unittest/mock.py", line 1157, in patched
     return func(*args, **keywargs)
   File "/Users/jeroenp/projects/django/tests/i18n/test_compilation.py",
 line 184, in test_msg
 fmt_error_including_non_ascii
     if cmd.gettext_version < (0, 18, 3):

 ....[snip]

   File "/Users/jeroenp/projects/django/django/core/management/utils.py",
 line 21, in popen_wr
 apper
     p = Popen(args, shell=False, stdout=PIPE, stderr=PIPE,
 close_fds=os.name != 'nt')
   File "/Users/jeroenp/projects/django/tests/i18n/test_compilation.py",
 line 171, in <lambda>
     lambda *args, **kwargs: Popen(*args, env={'LANG': 'C'}, **kwargs))
   File
 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.
 5/subprocess.py", line 950, in __init__
     restore_signals, start_new_session)
   File
 
"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.
 5/subprocess.py", line 1544, in _execute_child
    raise child_exception_type(errno_num, err_msg)
 django.core.management.base.CommandError: Error executing xgettext: No
 such file or directory
 : 'xgettext'

 ----------------------------------------------------------------------
 Ran 10518 tests in 97.610s
 }}}


 Verifying with a stripped environment in a shell:

 {{{
 (django-env-py3) tests$ env -i LANG=C xgettext
 env: xgettext: No such file or directory
 (django-env-py3) tests$ which xgettext
 /usr/local/bin/xgettext
 (django-env-py3) tests$ env -i LANG=C  PATH=/usr/local/bin:/usr/bin:/bin
 xgettext
 xgettext: no input file given
 Try 'xgettext --help' for more information.
 }}}

 Adding a hardcoded PATH to the env argument to Popen in
 test_compilation.py fixes this, but I'm assuming that's not the way to go
 forward.

 See #25925

--
Ticket URL: <https://code.djangoproject.com/ticket/26232>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.3216192bb2ec9b5487ad37d161044005%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to