-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Adam GROSZER wrote:
> Hello Tres,
> 
> Thursday, June 3, 2010, 5:29:41 PM, you wrote:
> 
> TS> -----BEGIN PGP SIGNED MESSAGE-----
> TS> Hash: SHA1
> 
> TS> Adam GROSZER wrote:
> 
>>>> Log message for revision 110723:
>>>>  Switch doctests to use the stdlib ``doctest`` module.
>>>>
>>>>  o Disuse than the deprecated ``zope.testing.doctest`` variant.
>>>>
>>>>  Remove a duplicated import.
>>>>
>>>>
>>>> Changed:
>>>>  U   zope.app.testing/trunk/CHANGES.txt
>>>>  U   zope.app.testing/trunk/src/zope/app/testing/functional.py
>>>>  U   zope.app.testing/trunk/src/zope/app/testing/tests.py
>>> The problem with this is that it just breaks tests that have accented
>>> unicode characters.
>>>
>>> zope.app.testing.functional.FunctionalDocFileSuite breaks, while
>>> zope.testing.doctest.DocFileSuite works.
>>> I don't remember what was the final decision on deprecating
>>> zope.testing.doctest, but this definitely s*cks.
>>>
>>> Thoughts?
> 
> TS> What tests are breaking?
> 
> Our apps's tests.
> Excerpt is:
> 
> # -*- coding: UTF-8 -*-
> <snip>
>   >>> mail = mailer.prepareEmail(u"Some subject",
>   ...     u"Some body éáÉÁ",
>   ...     u"f...@me.com",
>   ...     u"t...@you.com")
> <snip>
> 
> With the stdlib doctest prepareEmail gets
> u'Some body \xc3\xa9\xc3\xa1\xc3\x89\xc3\x81'
> Note, it's unicode() and utf-8 encoded at the same time.
> I guess stdlib doctest does not care about # -*- coding: UTF-8 -*-

The stdlib wants any non-ASCII encoding passed to the testsuite
constructor, e.g. (this is from Lib/test/test_doctest.py in Python 2.6)::

   If the tests contain non-ASCII characters, we have to specify which
   encoding the file is encoded with. We do so by using the `encoding`
   parameter:

     >>> suite = doctest.DocFileSuite('test_doctest.txt',
     ...                              'test_doctest2.txt',
     ...                              'test_doctest4.txt',
     ...                              encoding='utf-8')
     >>> suite.run(unittest.TestResult())



Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tsea...@palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkwIBQYACgkQ+gerLs4ltQ5CUQCffTlpUV1CAHKF0+KjQr3Bh5ri
590AnizdczOZQDVPval0w490lgfOhkUx
=Ayqa
-----END PGP SIGNATURE-----

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to