lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

Unittests get unicode in python 2.6 #144

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Python Unittests fail on python 2.6 (haven't tested other pythons) because the 
doctests expect strings and get unicode.

Attached is a patch which makes the tests pass.

Original issue reported on code.google.com by newmani...@gmail.com on 5 Aug 2010 at 6:09

Attachments:

GoogleCodeExporter commented 8 years ago
Yeah, this is a problem with different JSON libraries. The standard library 
json returns unicode, but simplejson doesn't. I'm not sure there's an easy way 
out here.

Original comment by djc.ochtman on 7 Aug 2010 at 2:39

GoogleCodeExporter commented 8 years ago

Original comment by wickedg...@gmail.com on 22 Sep 2012 at 12:44

GoogleCodeExporter commented 8 years ago
I would like to change the doctests so that the tests fail on older versions of 
python, rather than newer.

Reasoning is that fewer and fewer people are going to be using old versions of 
python as time goes on, and backwards compat with 2.5 will be less and less 
important (I am of the opinion that it's of zero importance now, because anyone 
using python 2.5 with couchdb-python is probably not in a position to upgrade 
couchdb-python either).

In any case, I'm going to work up a patch even if it won't be accepted, because 
I can't run the tests as-is, and I'm not going to install 2.5 in my dev 
environment.

Original comment by wickedg...@gmail.com on 9 Oct 2012 at 6:12

GoogleCodeExporter commented 8 years ago
`make test` passes under python 2.7.3.

I had to `hg diff -b -r default > doctest_unicode.patch` since the repo 
currently has trailing whitespace (seems like only on blank lines?).

Original comment by wickedg...@gmail.com on 9 Oct 2012 at 7:03

Attachments:

GoogleCodeExporter commented 8 years ago
Ah, but it's not just older vs. newer. It's also python *with* simplejson 
installed vs without. And since I would presume most serious CouchDB users to 
have simplejson installed (since AFAIK there's a big performance diff between 
2.7 stdlib json and latest simplejson), I don't think this is a good patch to 
take.

Also, please don't mark issues as fixed until they've been committed.

Original comment by djc.ochtman on 10 Oct 2012 at 7:27

GoogleCodeExporter commented 8 years ago
I wonder could there be used experience from this thread:
http://mail.python.org/pipermail/python-dev/2010-March/098166.html
also u'...' strings in doctests will make harder to add python 3.x support in 
future.

Original comment by kxepal on 10 Oct 2012 at 8:24

GoogleCodeExporter commented 8 years ago
Related issue thread in project:
https://bitbucket.org/fiji/django-3k/issue/6/resolve-issue-with-unicode-test-cas
es
Probably, there could be done similar trick based not on python version, but on 
json module that does/doesn't emits unicode string.

Original comment by kxepal on 10 Oct 2012 at 8:37

GoogleCodeExporter commented 8 years ago
Issue 219 has been merged into this issue.

Original comment by djc.ochtman on 25 Apr 2013 at 10:28

GoogleCodeExporter commented 8 years ago

Original comment by djc.ochtman on 25 Apr 2013 at 11:16

GoogleCodeExporter commented 8 years ago
This issue has been migrated to GitHub. Please continue discussion here:

https://github.com/djc/couchdb-python/issues/144

Original comment by djc.ochtman on 15 Jul 2014 at 7:18