update to 4.7

This commit is contained in:
?ngel ?lvarez 2018-05-02 15:25:36 +02:00
parent 3190e20356
commit 4e25a2fac6
12 changed files with 138 additions and 27 deletions

57
.drone.yml Normal file
View File

@ -0,0 +1,57 @@
clone:
hg:
image: plugins/hg
pipeline:
tox:
image: ${IMAGE}
environment:
- CFLAGS=-O0
- DB_CACHE=/cache
- TOX_TESTENV_PASSENV=CFLAGS DB_CACHE
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
commands:
- pip install tox
- tox -e "${TOXENV}-${DATABASE}"
notify:
image: drillster/drone-email
from: drone@localhost
host: smtp
port: 25
skip_verify: true
when:
status: [ changed, failure ]
services:
postgresql:
image: postgres
when:
matrix:
DATABASE: postgresql
matrix:
include:
- IMAGE: python:2.7
TOXENV: py27
DATABASE: sqlite
- IMAGE: python:2.7
TOXENV: py27
DATABASE: postgresql
- IMAGE: python:3.4
TOXENV: py34
DATABASE: sqlite
- IMAGE: python:3.4
TOXENV: py34
DATABASE: postgresql
- IMAGE: python:3.5
TOXENV: py35
DATABASE: sqlite
- IMAGE: python:3.5
TOXENV: py35
DATABASE: postgresql
- IMAGE: python:3.6
TOXENV: py36
DATABASE: sqlite
- IMAGE: python:3.6
TOXENV: py36
DATABASE: postgresql

View File

@ -1,19 +1,19 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.pool import Pool
from .quality import *
from . import quality
def register():
Pool.register(
Environment,
Template,
QualitativeTemplateLine,
QuantitativeTemplateLine,
TemplateLine,
StressTest,
QualityTest,
QualitativeLine,
QuantitativeLine,
TestLine,
quality.Environment,
quality.Template,
quality.QualitativeTemplateLine,
quality.QuantitativeTemplateLine,
quality.TemplateLine,
quality.StressTest,
quality.QualityTest,
quality.QualitativeLine,
quality.QuantitativeLine,
quality.TestLine,
module='quality_control_stress_test', type_='model')

View File

@ -9,7 +9,6 @@ from trytond.modules.quality_control.quality import _STATES
__all__ = ['Environment', 'Template', 'QualitativeTemplateLine',
'QuantitativeTemplateLine', 'TemplateLine', 'QualityTest', 'StressTest',
'QualitativeLine', 'QuantitativeLine', 'TestLine']
__metaclass__ = PoolMeta
class Environment(ModelSQL, ModelView):
@ -23,6 +22,7 @@ class Environment(ModelSQL, ModelView):
class Template:
__name__ = 'quality.template'
__metaclass__ = PoolMeta
environments = fields.One2Many('quality.stress_environment', 'template',
'Stress Environments')
@ -52,6 +52,7 @@ class Template:
class QualitativeTemplateLine:
__name__ = 'quality.qualitative.template.line'
__metaclass__ = PoolMeta
environment = fields.Many2One('quality.stress_environment',
'Stress Environment',
@ -96,6 +97,8 @@ class StressTest(ModelSQL, ModelView):
class QualityTest:
__name__ = 'quality.test'
__metaclass__ = PoolMeta
stress_tests = fields.One2Many('quality.stress_test', 'test',
'Stress Tests', states=_STATES, depends=['state'])
@ -154,6 +157,7 @@ class QualityTest:
class QualitativeLine:
__name__ = 'quality.qualitative.test.line'
__metaclass__ = PoolMeta
stress_test = fields.Many2One('quality.stress_test',
'Stress Environment',

View File

@ -4,15 +4,23 @@
from setuptools import setup
import re
import os
import ConfigParser
import io
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
MODULE = 'quality_control_stress_test'
PREFIX = 'nantic'
MODULE2PREFIX = {}
MODULE2PREFIX = {
'quality_control': 'nantic',
}
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):
@ -24,7 +32,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'):
@ -38,14 +46,33 @@ minor_version = int(minor_version)
requires = []
for dep in info.get('depends', []):
if not re.match(r'(ir|res|webdav)(\W|$)', dep):
if not re.match(r'(ir|res)(\W|$)', dep):
prefix = MODULE2PREFIX.get(dep, 'trytond')
requires.append('%s_%s >= %s.%s, < %s.%s' %
(prefix, dep, major_version, minor_version,
major_version, minor_version + 1))
requires.append(get_require_version('%s_%s' % (prefix, dep)))
requires.append(get_require_version('trytond'))
tests_require = [get_require_version('proteus')]
tests_require = [
get_require_version('proteus'),
]
series = '%s.%s' % (major_version, minor_version)
if minor_version % 2:
branch = 'default'
else:
branch = series
dependency_links = [
('hg+https://bitbucket.org/nantic/'
'trytond-quality_control@%(branch)s'
'#egg=nantic-quality_control-%(series)s' % {
'branch': branch,
'series': series,
}),
]
if minor_version % 2:
# Add development index for testing with proteus
dependency_links.append('https://trydevpi.tryton.org/')
setup(name='%s_%s' % (PREFIX, MODULE),
version=version,
@ -82,12 +109,17 @@ setup(name='%s_%s' % (PREFIX, MODULE),
'Natural Language :: Russian',
'Natural Language :: Spanish',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business',
],
license='GPL-3',
install_requires=requires,
dependency_links=dependency_links,
zip_safe=False,
entry_points="""
[trytond.modules]
@ -96,4 +128,7 @@ setup(name='%s_%s' % (PREFIX, MODULE),
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
use_2to3=True,
convert_2to3_doctests=[
],
)

15
tox.ini Normal file
View File

@ -0,0 +1,15 @@
[tox]
envlist = {py27,py34,py35,py36}-{sqlite,postgresql},pypy-{sqlite,postgresql}
[testenv]
commands = {envpython} setup.py test
deps =
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
pypy-postgresql: psycopg2cffi >= 2.5
sqlite: sqlitebck
setenv =
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
sqlite: DB_NAME={env:SQLITE_NAME::memory:}
postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
install_command = pip install --pre --process-dependency-links {opts} {packages}

View File

@ -1,5 +1,5 @@
[tryton]
version=4.1.0
version=4.7.0
depends:
quality_control
xml:

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--The COPYRIGHT file at the top level of this repository
contains the full copyright notices and license terms. -->
<form string="Stress Environment">
<form>
<label name="name"/>
<field name="name"/>
<label name="template"/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--The COPYRIGHT file at the top level of this repository
contains the full copyright notices and license terms. -->
<tree string="Stress Environment">
<tree>
<field name="template"/>
<field name="name"/>
</tree>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--The COPYRIGHT file at the top level of this repository
contains the full copyright notices and license terms. -->
<form string="Quality Stress Test">
<form>
<label name="test"/>
<field name="test"/>
<label name="environment"/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--The COPYRIGHT file at the top level of this repository
contains the full copyright notices and license terms. -->
<tree string="Quality Stress Tests">
<tree>
<field name="test"/>
<field name="environment"/>
<field name="start" widget="date"/>