Add Python3 support

issue3211
review16041002
This commit is contained in:
Jonathan Levy committed 2016-03-08 22:25:44 +01:00
1 parent 2f08290d2b
commit fb5fe2ec26
7 files changed
+29 -11

No files matched your search

+2 -2
View File
@@ -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
+2
View File
@@ -1,3 +1,5 @@
* Add Python3 support
Version 3.8.0 - 2015-11-02
* Bug fixes (see mercurial logs for details)
+2 -1
View File
@@ -6,10 +6,10 @@ from trytond.pool import Pool, PoolMeta
from trytond.modules.analytic_account import AnalyticMixin
__all__ = ['Purchase', 'PurchaseLine', 'AnalyticAccountEntry']
__metaclass__ = PoolMeta
class Purchase:
__metaclass__ = PoolMeta
__name__ = "purchase.purchase"
@classmethod
@@ -62,6 +62,7 @@ class PurchaseLine(AnalyticMixin):
class AnalyticAccountEntry:
__metaclass__ = PoolMeta
__name__ = 'analytic.account.entry'
@classmethod
+16 -3
View File
@@ -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_analytic_purchase.rst',
],
)
+3 -3
View File
@@ -13,7 +13,7 @@ Imports::
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts
>>> 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()
@@ -185,10 +185,10 @@ Analytic entries are not required until quotation::
>>> purchase_line.product = product
>>> purchase_line.quantity = 5
>>> purchase.save()
>>> purchase.click('quote')
>>> purchase.click('quote') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
UserError: ('UserError', (u'Analytic account is required for "Root" on line "product".', ''))
UserError: ...
>>> purchase_line, = purchase.lines
>>> entry, mandatory_entry = purchase_line.analytic_accounts
>>> mandatory_entry.account = mandatory_analytic_account
+2
View File
@@ -5,6 +5,7 @@ import doctest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
from trytond.tests.test_tryton import doctest_checker
class AnalyticPurchaseTestCase(ModuleTestCase):
@@ -18,5 +19,6 @@ def suite():
AnalyticPurchaseTestCase))
suite.addTests(doctest.DocFileSuite('scenario_analytic_purchase.rst',
setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
checker=doctest_checker,
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite
+2 -2
View File
@@ -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 =