[MERGE] BundleTester.test_alt_timezone_bundle fails on non-English platforms

Lukáš Lalinský lalinsky at gmail.com
Sun Jul 22 14:55:09 BST 2007


Hi,

if I run selftest from bzr.dev on any day except thursday (the name
abbreviation is 'št', which is not ASCII-compatible), I get these failed
tests from test_bundle:

/usr/lib/python2.5/_strptime.py:397: UnicodeWarning: Unicode equal
comparison failed to convert both arguments to Unicode - interpreting
them as being unequal
  weekday = locale_time.a_weekday.index(found_dict['a'].lower())
FAIL:
test_bundle.V08BundleTester.test_alt_timezone_bundle                                                                                                                         
    not equal:
a = 'Mon 2006-07-10 20:51:26.000000000 +0530'
b = u'Po 2006-07-10 20:51:26.000000000 +0530'


FAIL:
test_bundle.V09BundleKnit1Tester.test_alt_timezone_bundle                                                                                                                    
    not equal:
a = 'Mon 2006-07-10 20:51:26.000000000 +0530'
b = u'Po 2006-07-10 20:51:26.000000000 +0530'

On thursday will the test suite fail with:

bzr: ERROR: exceptions.UnicodeEncodeError: 'ascii' codec can't encode
character u'\u0160' in position 38: ordinal not in range(128)

Traceback (most recent call last):
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/commands.py", line 729,
in run_bzr_catch_errors
    return run_bzr(argv)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/commands.py", line 691,
in run_bzr
    ret = run(*run_argv)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/commands.py", line 389,
in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/builtins.py", line 2515,
in run
    exclude_pattern=exclude
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/tests/__init__.py", line
2244, in selftest
    exclude_pattern=exclude_pattern)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/tests/__init__.py", line
2206, in run_suite
    result = runner.run(suite)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/tests/__init__.py", line
526, in run
    test.run(result)
  File "unittest.py", line 433, in run
    test(result)
  File "unittest.py", line 281, in __call__
    return self.run(*args, **kwds)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/tests/__init__.py", line
1146, in run
    return unittest.TestCase.run(self, result)
  File "unittest.py", line 267, in run
    result.addError(self, self._exc_info())
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/tests/__init__.py", line
253, in addError
    self.report_error(test, err)
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/tests/__init__.py", line
381, in report_error
    err[1],
  File "/home/lukas/projects/bzr/bzr.dev/bzrlib/progress.py", line 202,
in note
    self.to_messages_file.write(fmt_string % args)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0160' in
position 38: ordinal not in range(128)

These are two separate problems, the first one is caused by hardcoded
English weekday names in test_alt_timezone_bundle. The second one is
caused by format_highres_date/unpack_highres_date, which return
bytestrings in the current locale's encoding. I'm not sure if decoding
to unicode is the right fix for the second part, but as v08 bundle
serializer encodes it to utf-8, I guess it's ok (encoding a non-ASCII
bytestring would fail right away). 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzr-date-encoding.diff
Type: text/x-patch
Size: 4268 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070722/168cff2f/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Toto je =?ISO-8859-1?Q?digit=E1lne?=
	=?ISO-8859-1?Q?_podp=EDsan=E1?= =?UTF-8?Q?_=C4=8Das=C5=A5?=
	=?ISO-8859-1?Q?_spr=E1vy?=
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070722/168cff2f/attachment.pgp 


More information about the bazaar mailing list