diff --git a/.drone.yml b/.drone.yml index 9d7c769d8c..c4fd423e94 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,9 +1,9 @@ -image: python2.7 +image: python:all env: - POSTGRESQL_URI=postgresql://postgres@127.0.0.1:5432/ - MYSQL_URI=mysql://root@127.0.0.1:3306/ script: - pip install tox - - tox -e "py27-{sqlite,postgresql}" + - tox -e "{py27,py33,py34,py35}-{sqlite,postgresql}" --skip-missing-interpreters services: - postgres diff --git a/CHANGELOG b/CHANGELOG index ef76b2a74f..06c6095bee 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Add Python3 support + Version 3.8.0 - 2015-11-02 * Bug fixes (see mercurial logs for details) diff --git a/account.py b/account.py index b6abe9f7b6..1d935d8be3 100644 --- a/account.py +++ b/account.py @@ -6,10 +6,10 @@ from trytond.pool import PoolMeta __all__ = ['Move'] -__metaclass__ = PoolMeta class Move: + __metaclass__ = PoolMeta __name__ = 'account.move' @classmethod diff --git a/commission.py b/commission.py index 58f15ca766..150862629d 100644 --- a/commission.py +++ b/commission.py @@ -8,10 +8,10 @@ from trytond.pyson import Eval, Bool __all__ = ['Agent', 'Commission'] -__metaclass__ = PoolMeta class Agent: + __metaclass__ = PoolMeta __name__ = 'commission.agent' waiting_account = fields.Many2One('account.account', 'Waiting Account', domain=[ @@ -22,6 +22,7 @@ class Agent: class Commission: + __metaclass__ = PoolMeta __name__ = 'commission' waiting_move = fields.Many2One('account.move', 'Move', readonly=True) diff --git a/invoice.py b/invoice.py index 7ed13cd0f2..b656a7bbba 100644 --- a/invoice.py +++ b/invoice.py @@ -8,10 +8,10 @@ from trytond.model import ModelView, Workflow __all__ = ['Invoice', 'InvoiceLine'] -__metaclass__ = PoolMeta class Invoice: + __metaclass__ = PoolMeta __name__ = 'account.invoice' @classmethod @@ -48,6 +48,7 @@ class Invoice: class InvoiceLine: + __metaclass__ = PoolMeta __name__ = 'account.invoice.line' def get_move_line(self): diff --git a/setup.py b/setup.py index 7aa9c730e2..2c32bbbaca 100644 --- a/setup.py +++ b/setup.py @@ -5,11 +5,17 @@ from setuptools import setup import re import os -import ConfigParser +import io +try: + from configparser import ConfigParser +except ImportError: + from ConfigParser import ConfigParser def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() + return io.open( + os.path.join(os.path.dirname(__file__), fname), + 'r', encoding='utf-8').read() def get_require_version(name): @@ -21,7 +27,7 @@ def get_require_version(name): major_version, minor_version + 1) return require -config = ConfigParser.ConfigParser() +config = ConfigParser() config.readfp(open('tryton.cfg')) info = dict(config.items('tryton')) for key in ('depends', 'extras_depend', 'xml'): @@ -94,6 +100,9 @@ setup(name=name, 'Natural Language :: Spanish', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Office/Business', @@ -110,4 +119,8 @@ setup(name=name, test_suite='tests', test_loader='trytond.test_loader:Loader', tests_require=tests_require, + use_2to3=True, + convert_2to3_doctests=[ + 'tests/scenario_commission_waiting.rst', + ], ) diff --git a/tests/scenario_commission_waiting.rst b/tests/scenario_commission_waiting.rst index dd1d50d393..e5c6a1edcd 100644 --- a/tests/scenario_commission_waiting.rst +++ b/tests/scenario_commission_waiting.rst @@ -12,7 +12,7 @@ Imports:: ... get_company >>> from trytond.modules.account.tests.tools import create_fiscalyear, \ ... create_chart, get_accounts, create_tax, set_tax_code - >>> from.trytond.modules.account_invoice.tests.tools import \ + >>> from trytond.modules.account_invoice.tests.tools import \ ... set_fiscalyear_invoice_sequences, create_payment_term >>> today = datetime.date.today() diff --git a/tests/test_commission_waiting.py b/tests/test_commission_waiting.py index 74a85aedc9..c3eb328c87 100644 --- a/tests/test_commission_waiting.py +++ b/tests/test_commission_waiting.py @@ -8,6 +8,7 @@ import doctest from trytond.tests.test_tryton import ModuleTestCase from trytond.tests.test_tryton import suite as test_suite from trytond.tests.test_tryton import doctest_setup, doctest_teardown +from trytond.tests.test_tryton import doctest_checker class CommissionWaitingTestCase(ModuleTestCase): @@ -21,5 +22,6 @@ def suite(): CommissionWaitingTestCase)) suite.addTests(doctest.DocFileSuite('scenario_commission_waiting.rst', setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8', + checker=doctest_checker, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) return suite diff --git a/tox.ini b/tox.ini index e9d2876444..e2a064851d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] -envlist = py27-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql} +envlist = {py27,py33,py34,py35}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql} [testenv] commands = {envpython} setup.py test deps = - py27-postgresql: psycopg2 >= 2.0 + {py27,py33,py34,py35}-postgresql: psycopg2 >= 2.0 pypy-postgresql: psycopg2cffi >= 2.5 mysql: MySQL-python setenv =