﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26232	i18n unit test fails on xgettext in /usr/local/bin	Jeroen Pulles	nobody	"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"	Bug	closed	Internationalization	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
