Unit tests fail in non-English locales

Bug #80088 reported by Marius Gedminas
This bug report is a duplicate of:  Bug #79761: locale-independent unit tests. Edit Remove
14
Affects Status Importance Assigned to Milestone
SchoolTool
In Progress
Medium
Unassigned

Bug Description

SchoolTool's unit tests fail in certain non-English locales (e.g. German).
This happens with SchoolTool 0.11.2, SchoolBell 1.2.2, and perhaps other
branches. I'm pretty sure trunk has this problem (although I've been unable to
reproduce it myself).

> ======================================================================
> FAIL: schooltool.tests.test_main.doctest_load_options
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "/usr/local/zope/schooltool-0.11.2/Zope3/src/zope/testing/doctest.py",
line 2187, in runTest
> raise self.failureException(self.format_failure(new.getvalue()))
> AssertionError: Failed doctest test for
schooltool.tests.test_main.doctest_load_options
> File "/usr/local/zope/schooltool-0.11.2/src/schooltool/tests/test_main.py",
line 88, in doctest_load_options
>.
> ----------------------------------------------------------------------
> File "/usr/local/zope/schooltool-0.11.2/src/schooltool/tests/test_main.py",
line 112, in schooltool.tests.test_main.doctest_load_options
> Failed example:
> o = server.load_options(['st.py', '-c', sample_config_file])
> Expected:
> Reading configuration from ...sample.conf
> st.py: warning: ignored configuration option 'module'
> st.py: warning: ignored configuration option 'domain'
> st.py: warning: ignored configuration option 'path'
> st.py: warning: ignored configuration option 'app_log_file'
> Got:
> Konfiguration von
/usr/local/zope/schooltool-0.11.2/src/schooltool/tests/sample.conf einlesen
...

This can be fixed either by fixing issue 76, or by adding back the workaround
(LC_ALL=C python test.py) to the Makefile.

I do not know who removed that workaround and why, but it used to be in our
Makefile precisely to prevent this bug.

Revision history for this message
Marius Gedminas (mgedmin) wrote :

The LC_ALL=C workaround is still there!

I suppose the GNU-extension $LANGUAGE might override $LC_ALL and cause this
problem. Perhaps change that Makefile line to

  LANGUAGE= LC_ALL=C $(python) test.py $(TESTFLAGS)

?

Revision history for this message
Philipp Schroeder (philipp.schroeder) wrote :

I tried the workaround suggested by mgedmin in the last message. In the
'Makefile' of the 'schooltool-0.11.2' directory, I couldn't find any line
containing LC_ALL=C. I found it in the 'Makefile' in the 'schoolbell-1.2.2'
directory, though.

I replaced that line as suggested. Then, I ran make test.

---------------------

# make test
[ ! -d Zope3 ] || cd Zope3 && python setup.py build_ext -i
running build_ext
running build_headers
python setup.py build
Extracting translations
running build
running build_py
running build_scripts
python remove-stale-bytecode.py

---------------------------------

--> 'make test' runs through without the error message I got previously, but I
don't get the usual confirmation message

"Ran XXX tests in YYY.ZZZs"

HTH

Revision history for this message
Philipp Schroeder (philipp.schroeder) wrote :

This bug is still unsolved in schoolbell-1.2.3 and schooltool-0.11.3 released
earlier today.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.