dcramer/django-uuidfield — pull request #18 by dominicrodger (2013-05-24 06:32:37+00:00)
Title: Python 3 support

I started work on Python 3 support today, since I'm trying to port an app of mine that uses django-uuidfield. You can see the beginnings of my work at https://github.com/dominicrodger/django-uuidfield/compare/py3.

I'm mostly there, there are two outstanding issues:

1. There's one failing test that I'd appreciate some help with if anyone's got any Python 3/Django/Postgres experience - `test_raises_exception` throws a `psycopg2.DataError` at the moment), but it did require switching the tests out from using django-nose to using the default Django test runner, since django-nose doesn't support Python 3 (see https://github.com/jbalogh/django-nose/pull/103). I'm not sure django-nose gets us a lot - it seems to run all the tests twice (I get 10 tests run, even though there are only 5 tests - if I add a simple failing test, I get 12 tests run, 2 failed), and the normal Django runner correctly runs 5 tests.
2. I'm not quite sure what the purpose of `smart_unicode` in `to_python` - the tests don't seem to hit it. I'm guessing just using `django.utils.smart_text` is the right approach if `smart_unicode` is still needed.

I've run the unit tests on Python 2.6, 2.7 and with Django 1.4.5 and 1.5.1 (as you'll see from my changes to `tox.ini`).

Does this approach look reasonable? If so, I'll tidy it up, figure out the Postgres issue and send a pull request.