Unit tests fail with a non-unicode locale

Bug #624283 reported by Matěj Cepl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyexiv2
Fix Released
Medium
Olivier Tilloy

Bug Description

See attached build log. Using

exiv2-0.20-1.fc14.x86_64
python-2.7-7.fc14.x86_64
boost-1.44.0-1.fc14.x86_64

Tags: build

Related branches

Revision history for this message
Matěj Cepl (mcepl) wrote :
Revision history for this message
Matěj Cepl (mcepl) wrote :

When tests are commented out, builds fine http://koji.fedoraproject.org/koji/taskinfo?taskID=2427073

Revision history for this message
Olivier Tilloy (osomon) wrote :

This is the output of the tests that are failing:

test_nonascii_unicode (encoding.TestEncodings) ... ERROR
test_nonascii_unicode_escaped (encoding.TestEncodings) ... ERROR

======================================================================
ERROR: test_nonascii_unicode (encoding.TestEncodings)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/matej/build/Extras/pyexiv2/pyexiv2-0.2.2/test/encoding.py", line 94, in test_nonascii_unicode
    self._test_filename(u'tést.jpg')
  File "/home/matej/build/Extras/pyexiv2/pyexiv2-0.2.2/test/encoding.py", line 82, in _test_filename
    self._create_file(filename)
  File "/home/matej/build/Extras/pyexiv2/pyexiv2-0.2.2/test/encoding.py", line 74, in _create_file
    os.remove(filename)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 1: ordinal not in range(128)

======================================================================
ERROR: test_nonascii_unicode_escaped (encoding.TestEncodings)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/matej/build/Extras/pyexiv2/pyexiv2-0.2.2/test/encoding.py", line 97, in test_nonascii_unicode_escaped
    self._test_filename(u't\xe9st.jpg')
  File "/home/matej/build/Extras/pyexiv2/pyexiv2-0.2.2/test/encoding.py", line 82, in _test_filename
    self._create_file(filename)
  File "/home/matej/build/Extras/pyexiv2/pyexiv2-0.2.2/test/encoding.py", line 74, in _create_file
    os.remove(filename)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 1: ordinal not in range(128)

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

Changed in pyexiv2:
importance: Undecided → Medium
status: New → Confirmed
tags: added: build
Revision history for this message
Olivier Tilloy (osomon) wrote :

Matěj, what is your system’s locale?

Revision history for this message
Matěj Cepl (mcepl) wrote :

jakoubek:Extras$ locale
LANG=cs_CZ.utf8
LC_CTYPE="cs_CZ.utf8"
LC_NUMERIC="cs_CZ.utf8"
LC_TIME="cs_CZ.utf8"
LC_COLLATE="cs_CZ.utf8"
LC_MONETARY="cs_CZ.utf8"
LC_MESSAGES="cs_CZ.utf8"
LC_PAPER="cs_CZ.utf8"
LC_NAME="cs_CZ.utf8"
LC_ADDRESS="cs_CZ.utf8"
LC_TELEPHONE="cs_CZ.utf8"
LC_MEASUREMENT="cs_CZ.utf8"
LC_IDENTIFICATION="cs_CZ.utf8"
LC_ALL=
jakoubek:Extras$

Revision history for this message
Olivier Tilloy (osomon) wrote :

I can reproduce by running the tests with a czech locale:

    LANG=cs_CZ.utf8 scons test

summary: - test fails when building on Fedora 14
+ Unit tests fail with a Czech locale
Revision history for this message
Olivier Tilloy (osomon) wrote : Re: Unit tests fail with a Czech locale

After correctly generating the locale on my system (locale-gen cs_CZ.utf8), the issue disappears.
In fact the issue is not with the Czech locale (it’s unicode, so it’s fine), it’s with the locale that is used by the build system:

    LANG=C
    export LANG

summary: - Unit tests fail with a Czech locale
+ Unit tests fail with a non-unicode locale
Revision history for this message
Olivier Tilloy (osomon) wrote :

Fixed in the trunk (revision 323).

Changed in pyexiv2:
assignee: nobody → Olivier Tilloy (osomon)
status: Confirmed → Fix Committed
Revision history for this message
Matěj Cepl (mcepl) wrote :

With the patch from revision 323 (http://pkgs.fedoraproject.org/gitweb/?p=pyexiv2.git;a=blob_plain;f=upstream-lp_bug_624283-Skip-unicode-unit-tests-for-unsupported-encodings.patch;hb=master) encoding tests go through, but I have still one test failing:

test_ascii_str (encoding.TestEncodings) ... ok
test_ascii_unicode (encoding.TestEncodings) ... ok
test_nonascii_unicode (encoding.TestEncodings) ... ok
test_nonascii_unicode_escaped (encoding.TestEncodings) ... ok

======================================================================
FAIL: test_write_dont_preserve_timestamps (metadata.TestImageMetadata)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/matej/build/Extras/pyexiv2/pyexiv2-0.2.2/test/metadata.py", line 122, in test_write_dont_preserve_timestamps
    self.failIfEqual(atime2, atime)
AssertionError: 1282851765.0 == 1282851765.0

----------------------------------------------------------------------
Ran 131 tests in 2.409s

(BTW and just FYI, I have created a git mirror of pyexiv2 on gitorious at http://gitorious.org/pyexiv2/mainline)

Revision history for this message
Matěj Cepl (mcepl) wrote :

(sorry, the last link should read http://gitorious.org/pyexiv2/pyexiv2)

Revision history for this message
Olivier Tilloy (osomon) wrote :

Matěj, the issue you mention in comment #9 is almost certainly unrelated with this bug. Can you please file another bug report? Thanks!

Revision history for this message
Matěj Cepl (mcepl) wrote :
Olivier Tilloy (osomon)
Changed in pyexiv2:
milestone: none → 0.3
Olivier Tilloy (osomon)
Changed in pyexiv2:
status: Fix Committed → Fix Released
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.