From 4dc4673cd265a1db8edc03cb233c81987d735bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 16 Apr 2022 18:30:17 +0200 Subject: [PATCH] Replace test setuptools command by unittest discover issue9215 review389851002 --- setup.py | 6 +++--- tests/__init__.py | 8 -------- tests/{test_party_relationship.py => test_module.py} | 9 ++------- tox.ini | 3 ++- 4 files changed, 7 insertions(+), 19 deletions(-) rename tests/{test_party_relationship.py => test_module.py} (97%) diff --git a/setup.py b/setup.py index 16202219d4..e60acbfdae 100755 --- a/setup.py +++ b/setup.py @@ -137,13 +137,13 @@ setup(name=name, license='GPL-3', python_requires='>=3.7', install_requires=requires, + extras_require={ + 'test': tests_require, + }, dependency_links=dependency_links, zip_safe=False, entry_points=""" [trytond.modules] party_relationship = trytond.modules.party_relationship """, - test_suite='tests', - test_loader='trytond.test_loader:Loader', - tests_require=tests_require, ) diff --git a/tests/__init__.py b/tests/__init__.py index 9cb64b4448..4effdfa4a2 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,10 +1,2 @@ # 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_relationship.tests.test_party_relationship import \ - suite # noqa: E501 -except ImportError: - from .test_party_relationship import suite - -__all__ = ['suite'] diff --git a/tests/test_party_relationship.py b/tests/test_module.py similarity index 97% rename from tests/test_party_relationship.py rename to tests/test_module.py index d5e9009a1e..ae327cd8ed 100644 --- a/tests/test_party_relationship.py +++ b/tests/test_module.py @@ -5,9 +5,7 @@ import unittest from trytond import backend from trytond.pool import Pool -from trytond.tests.test_tryton import ModuleTestCase -from trytond.tests.test_tryton import suite as tryton_suite -from trytond.tests.test_tryton import with_transaction +from trytond.tests.test_tryton import ModuleTestCase, with_transaction from trytond.transaction import Transaction @@ -294,7 +292,4 @@ class TestCase(ModuleTestCase): ['A', 'C', 'B']) -def suite(): - suite = tryton_suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestCase)) - return suite +del ModuleTestCase diff --git a/tox.ini b/tox.ini index 48abd4ff09..d5e3bd93b4 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,9 @@ envlist = {py37,py38,py39,py310}-{sqlite,postgresql} [testenv] +extras = test commands = - coverage run --include=.*/party_relationship/* setup.py test + coverage run --include=.*/party_relationship/* -m unittest discover -s tests coverage report --include=.*/party_relationship/* --omit=*/tests/* deps = coverage