I'm working on a port of Django to Python 3. I'm getting close, and in
terms of
test coverage pretty much almost there, but a few remaining test
failures are
eluding me, and I could probably use some help to speed things up.

I started with the features/py3k branch on the BitBucket Django mirror
(the one
at https://bitbucket.org/django/django), but whereas that was
approaching from
a point of view of running 2to3 over the Django codebase, I've
followed my
preferred strategy of aiming for a single codebase for 2.x and 3.x.
(This
strategy worked well for the virtualenv and pip ports which I did a
while ago.)

I've updated the django.utils.py3 module to add whatever I needed,
gratefully
borrowing ideas from Benjamin Peterson's six project as needed. I run
the
standard test suite on the codebase using Python 2.7.2 and 3.2.2 (I'm
not
supporting 3.0 or 3.1 - 3.2 is stable, 'callable' came back and is
liberally
used in Django, and I'm not sure it's worth bothering with support for
3.0/3.1.

The branch is available at

https://bitbucket.org/vinay.sajip/django (features/py3k branch)

Latest test result summaries are as follows:

2.7.2: ran 4229 tests in 301.690s
OK (skipped=71, expected failures=3)

3.2.2: Ran 4174 tests in 303.619s
FAILED (failures=6, errors=2, skipped=78, expected failures=2,
        unexpected successes=1)

I think these results are encouraging, and I hope you agree! I added 7
skips,
mostly these are due to different representations on 2.x and 3.x e.g.
u'foo'
vs. 'foo'.

I'm posting the summary results to

https://gist.github.com/1373553

The verbose listings are too big to post together to Github, giving me
an
"Entity Too Large" error. So these are posted separately to

https://gist.github.com/1393994 (2.7.2)

and

https://gist.github.com/1394000 (3.2.2).

The failures are:

ERROR: test_bad_404_template
(regressiontests.test_client_regress.models.TemplateExceptionTests)
I think this is due to Django trying to handle an unaught exception
and failing
to find the 4500.html template, because the test has set the templates
path to a
bad value (deliberately, for the purpose of the test).

ERROR: test_cull
(regressiontests.cache.tests.DBCacheTests)
This raises a "sqlite3.IntegrityError: datatype mismatch" but I
haven't yet
found the underlying cause.

FAIL: test_modelform_factory_metaclass
(regressiontests.model_forms_regress.tests.CustomMetaclassTestCase)
This is down to the way metaclasses are implemented slightly
differently.

FAIL: test_lazy_objects
(regressiontests.i18n.tests.TranslationTests)
Proxy object comparison code differs between 2.x and 3.x, needs
looking at.

FAIL: test_RegexValidator_raises_error_23
(modeltests.validators.tests.TestSimpleValidators)
I haven't tracked this down yet.

FAIL: testParsing
(regressiontests.conditional_processing.models.ETagProcessing)
This is down to different representations on 2.x and 3.x:
e\"t\"ag vs. e"t"ag

FAIL: test_null_display_for_field
(regressiontests.admin_util.tests.UtilTests)
This is also down to proxy comparison logic.

FAIL: test_templates
(regressiontests.templates.tests.Templates)
This is down to representational differences between 2.x and 3.x.

I did the work and ran the tests on a VM running Ubuntu Oneiric Ocelot
(x64).
You can hopefully reproduce these by cloning my repository, updating
to the
features/py3k branch, and then running one of

PYTHONPATH=.. python2.7 -u runtests.py --settings test_sqlite

or

PYTHONPATH=.. python3.2 -u runtests.py --settings test_sqlite

in the tests directory. The work's taken about a week of elapsed time
(on and
off), and I haven't tracked any changes in the default branch since
then.

Of course, I realise there's still a lot left to do, but I hope I have
broken
the back of it. I've approached it just from the point of trying to
get the
tests to pass, and not (yet) focused on actually running realistic
scenarios.
Perhaps some of my fixes need changing - having other devs' eyeballs
on the
code can definitely help.

Please let me have your comments!

Regards,

Vinay Sajip

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to