Replace test setuptools command by unittest discover
issue9215 review389851002
This commit is contained in:
@@ -142,6 +142,7 @@ setup(name=name,
|
||||
python_requires='>=3.7',
|
||||
install_requires=requires,
|
||||
extras_require={
|
||||
'test': tests_require,
|
||||
'VIES': ['python-stdnum[SOAP]'],
|
||||
'phonenumbers': ['phonenumbers'],
|
||||
},
|
||||
@@ -151,7 +152,4 @@ setup(name=name,
|
||||
[trytond.modules]
|
||||
party = trytond.modules.party
|
||||
""",
|
||||
test_suite='tests',
|
||||
test_loader='trytond.test_loader:Loader',
|
||||
tests_require=tests_require,
|
||||
)
|
||||
|
||||
+2
-6
@@ -1,10 +1,6 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
try:
|
||||
from trytond.modules.party.tests.test_party import (
|
||||
PartyCheckEraseMixin, suite)
|
||||
except ImportError:
|
||||
from .test_party import PartyCheckEraseMixin, suite
|
||||
from .test_module import PartyCheckEraseMixin
|
||||
|
||||
__all__ = ['suite', 'PartyCheckEraseMixin']
|
||||
__all__ = ['PartyCheckEraseMixin']
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import doctest
|
||||
import unittest
|
||||
|
||||
try:
|
||||
@@ -8,16 +7,13 @@ try:
|
||||
except ImportError:
|
||||
phonenumbers = None
|
||||
|
||||
import trytond.tests.test_tryton
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.modules.party.party import IDENTIFIER_TYPES
|
||||
from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import (
|
||||
ModuleTestCase, doctest_checker, doctest_teardown, with_transaction)
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
from ..party import IDENTIFIER_TYPES
|
||||
|
||||
|
||||
class PartyCheckEraseMixin:
|
||||
|
||||
@@ -496,22 +492,4 @@ class PartyTestCase(PartyCheckEraseMixin, ModuleTestCase):
|
||||
[('A', 0), ('B', None)])
|
||||
|
||||
|
||||
def suite():
|
||||
suite = trytond.tests.test_tryton.suite()
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(PartyTestCase))
|
||||
suite.addTests(doctest.DocFileSuite(
|
||||
'scenario_party_replace.rst',
|
||||
tearDown=doctest_teardown, encoding='utf-8',
|
||||
checker=doctest_checker,
|
||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
||||
suite.addTests(doctest.DocFileSuite(
|
||||
'scenario_party_erase.rst',
|
||||
tearDown=doctest_teardown, encoding='utf-8',
|
||||
checker=doctest_checker,
|
||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
||||
suite.addTests(doctest.DocFileSuite(
|
||||
'scenario_party_phone_number.rst',
|
||||
tearDown=doctest_teardown, encoding='utf-8',
|
||||
checker=doctest_checker,
|
||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
||||
return suite
|
||||
del ModuleTestCase
|
||||
@@ -0,0 +1,22 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
import doctest
|
||||
import glob
|
||||
import os
|
||||
|
||||
from trytond.tests.test_tryton import doctest_checker, doctest_teardown
|
||||
|
||||
|
||||
def load_tests(loader, tests, pattern):
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
for scenario in glob.glob('*.rst'):
|
||||
tests.addTests(doctest.DocFileSuite(
|
||||
scenario, tearDown=doctest_teardown, encoding='utf-8',
|
||||
checker=doctest_checker,
|
||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
return tests
|
||||
@@ -2,8 +2,9 @@
|
||||
envlist = {py37,py38,py39,py310}-{sqlite,postgresql}
|
||||
|
||||
[testenv]
|
||||
extras = test
|
||||
commands =
|
||||
coverage run --include=.*/party/* setup.py test
|
||||
coverage run --include=.*/party/* -m unittest discover -s tests
|
||||
coverage report --include=.*/party/* --omit=*/tests/*
|
||||
deps =
|
||||
coverage
|
||||
|
||||
Reference in New Issue
Block a user