[PATCH 0/9] Add Python 3 support

Stephen Finucane stephen.finucane at intel.com
Mon Nov 30 09:10:41 AEDT 2015


After many nights of wrestling with unicode issues and the many other
Python2/3 discrepancies, I finally managed to get all unit tests to
pass under Python 3 (while retaining Python 2.7 support, naturally).

patchwork needs Python 3 support. Python 3 is a better languages than
Python 2.7 and will replace it sooner rather than later. Django 2.0 is
still some years off, but when it arrives it will be the first version
to support only Python. Even now, some package maintainers are
packing Python 3-only versions of libraries like Django [1]. This is
happening and we need to embrace it.

Because of the sheer amount of code this touches, I'd like some eyes on
these changes. Most of the changes were generated automatically, but
there are more than needed to be resolved manually. As such, the former
can probably be reviewed casually while the others require more
in-depth review. I'll work on expanding code coverage during my spare
time this week to see if I can root out any bugs.

I'd also like an answer to the following questions: do we care about
Python 2.6? I've included imports for the 'absolute_import' future
import to retain some support, but I don't have any way to validate the
functionality without manually installing Python 2.6 (which I'm loathe
to do).

Stephen Finucane (9):
  tox: Add Python 3.4 targets
  requirements: Update version of dateutil used
  py3: Add required 'future' imports
  trivial: Reorder imports
  py3: "Modernize" code base
  py3: Fix Django models Python3 compatibility
  py3: max does not accept 'None'
  py3: Resolve unicode issues
  py3: Remove all deprecated UnitTest calls

 docs/TODO                                |   2 -
 patchwork/admin.py                       |   8 +-
 patchwork/bin/parsearchive.py            |   4 +-
 patchwork/bin/parsemail.py               |  19 +++--
 patchwork/bin/update-patchwork-status.py |  10 +--
 patchwork/filters.py                     |  32 ++++----
 patchwork/forms.py                       |   2 +
 patchwork/management/commands/cron.py    |   1 +
 patchwork/management/commands/retag.py   |   1 +
 patchwork/models.py                      |  74 +++++++++++--------
 patchwork/paginator.py                   |   5 +-
 patchwork/parser.py                      |  19 +++--
 patchwork/requestcontext.py              |   7 +-
 patchwork/settings/dev.py                |   4 +-
 patchwork/settings/production.example.py |   4 +-
 patchwork/templatetags/listurl.py        |  16 ++--
 patchwork/templatetags/patch.py          |   4 +-
 patchwork/templatetags/person.py         |   9 ++-
 patchwork/templatetags/syntax.py         |  15 ++--
 patchwork/tests/test_bundles.py          |  91 ++++++++++++-----------
 patchwork/tests/test_checks.py           |   5 +-
 patchwork/tests/test_confirm.py          |   8 +-
 patchwork/tests/test_encodings.py        |  15 ++--
 patchwork/tests/test_expiry.py           |   7 +-
 patchwork/tests/test_filters.py          |  11 ++-
 patchwork/tests/test_list.py             |  22 ++++--
 patchwork/tests/test_mail_settings.py    | 122 ++++++++++++++++---------------
 patchwork/tests/test_mboxviews.py        |  16 ++--
 patchwork/tests/test_notifications.py    |  57 ++++++++-------
 patchwork/tests/test_patchparser.py      | 112 ++++++++++++++--------------
 patchwork/tests/test_person.py           |  33 +++++----
 patchwork/tests/test_registration.py     |  65 ++++++++--------
 patchwork/tests/test_tags.py             |  12 +--
 patchwork/tests/test_updates.py          |  12 +--
 patchwork/tests/test_user.py             |  57 ++++++++-------
 patchwork/tests/test_user_browser.py     |   3 +-
 patchwork/tests/test_xmlrpc.py           |  11 ++-
 patchwork/tests/utils.py                 |  15 ++--
 patchwork/urls.py                        |   3 +-
 patchwork/utils.py                       |  18 +++--
 patchwork/views/__init__.py              |  19 ++---
 patchwork/views/base.py                  |  15 ++--
 patchwork/views/bundle.py                |  13 ++--
 patchwork/views/mail.py                  |  15 ++--
 patchwork/views/patch.py                 |  17 +++--
 patchwork/views/project.py               |   6 +-
 patchwork/views/user.py                  |  24 +++---
 patchwork/views/xmlrpc.py                |  61 +++++++++-------
 requirements-test.txt                    |   2 +-
 tox.ini                                  |   3 +-
 50 files changed, 627 insertions(+), 479 deletions(-)

-- 
2.0.0



More information about the Patchwork mailing list