[Zope3-dev] test errors due to ascii defaultencoding assumption

Stefan Rank e9725431 at student.tuwien.ac.at
Wed Oct 19 03:25:50 EDT 2005


Hi list

I recently ran the zope3 test suite on a fresh checkout.
and I have a non-ascii default encoding set up in my python's
site.py file. To be exact, on Windows it is::

   In [1]: import sys
   In [2]: sys.getdefaultencoding()
   Out[2]: 'cp1252'

(on the Linux box it's 'utf-8')

I get several test errors, I'll only post the first one here::

   Error in test testBucketGet (BTrees.tests.test_compare.CompareTest)
   Traceback (most recent call last):
     File "C:\Python24\lib\unittest.py", line 251, in run
       self.setUp()
     File 
"d:\HOME\_programmieren\Zope3\src\BTrees\tests\test_compare.py", line 
32, in setUp
       self.assertRaises(UnicodeError, unicode, self.s)
     File "C:\Python24\lib\unittest.py", line 325, in failUnlessRaises
       raise self.failureException, "%s not raised" % excName
   AssertionError: UnicodeError not raised

this is because of the following lines of the test setup::

   # These defaults only make sense if the default encoding
   # prevents s from being promoted to Unicode.
   self.assertRaises(UnicodeError, unicode, self.s)

Well mine doesn't. :)

Two questions:

- would it make sense to put::

     reload(sys)
     sys.setdefaultencoding('ascii')

   there instead?
   To allow the tests to run also on non-default systems.

- does a non-ascii defaultencoding pose a risk for running Zope3?

cheers,
stefan


More information about the Zope3-dev mailing list