From b7a4f3bcfc2f5ebcfff86e35db80424626c1d237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 16 Apr 2022 18:30:16 +0200 Subject: [PATCH] Replace test setuptools command by unittest discover issue9215 review389851002 --- setup.py | 6 +++--- tests/__init__.py | 8 -------- tests/{test_account_fr_chorus.py => test_module.py} | 9 +-------- tox.ini | 3 ++- 4 files changed, 6 insertions(+), 20 deletions(-) rename tests/{test_account_fr_chorus.py => test_module.py} (65%) diff --git a/setup.py b/setup.py index 72b5d47adc..bef292a8ba 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] account_fr_chorus = trytond.modules.account_fr_chorus """, - test_suite='tests', - test_loader='trytond.test_loader:Loader', - tests_require=tests_require, ) diff --git a/tests/__init__.py b/tests/__init__.py index 928a1a3852..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.account_fr_chorus.tests.test_account_fr_chorus import \ - suite # noqa: E501 -except ImportError: - from .test_account_fr_chorus import suite - -__all__ = ['suite'] diff --git a/tests/test_account_fr_chorus.py b/tests/test_module.py similarity index 65% rename from tests/test_account_fr_chorus.py rename to tests/test_module.py index 2921d43867..edb8304c21 100644 --- a/tests/test_account_fr_chorus.py +++ b/tests/test_module.py @@ -1,11 +1,8 @@ # 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 unittest - from trytond.modules.company.tests import CompanyTestMixin from trytond.tests.test_tryton import ModuleTestCase -from trytond.tests.test_tryton import suite as test_suite class AccountFrChorusTestCase(CompanyTestMixin, ModuleTestCase): @@ -14,8 +11,4 @@ class AccountFrChorusTestCase(CompanyTestMixin, ModuleTestCase): extras = ['edocument_uncefact'] -def suite(): - suite = test_suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase( - AccountFrChorusTestCase)) - return suite +del ModuleTestCase diff --git a/tox.ini b/tox.ini index 1af27c3482..4df34676a3 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=.*/account_fr_chorus/* setup.py test + coverage run --include=.*/account_fr_chorus/* -m unittest discover -s tests coverage report --include=.*/account_fr_chorus/* --omit=*/tests/* deps = coverage