[py-dev] Creating unicode strings in pytest testsuit

holger krekel holger at merlinux.eu
Wed Apr 13 13:53:14 CEST 2011


Hey Floris,

On Mon, Apr 11, 2011 at 23:55 +0100, Floris Bruynooghe wrote:
> Hi
> 
> While working on the patch for the invalid unicode codepoints in the
> junitxml output I discovered it's fairly hard to create a unicode
> strings in the the test suite.  Currently I decided to use
> py.builtins._totext() to replace unicode string literals.  And to get
> access to the unichr() builtin I've done this little hack:
> 
> def foo():
>     global unichr
>     try:
>         unichr(65)
>     except NameError:
>         unichr = chr
> 
> I think both are fairly fine, though am surprised by the leading
> underscore in _totext(), I'd have rather expected a
> py.builtin.unicode() name or so.  And if the unichr hack is acceptable
> would it be worth to create py.builtins.unichr()?

i guess this makes sense so introducing a unicode and unicode (as
a duplicate for _totext for now) would make sense.

Btw, i'd like to do a py/pytest release around the coming weekend -
would be cool to have your fix in, even if the test isn't written
in the optimal way yet.

best & thanks,
holger

> Regards
> Floris
> 
> -- 
> Debian GNU/Linux -- The Power of Freedom
> www.debian.org | www.gnu.org | www.kernel.org
> _______________________________________________
> py-dev mailing list
> py-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/py-dev
> 



More information about the Pytest-dev mailing list