From dfa0fee9de703eb86d4f6dde91fe652d171f087a 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_credit_limit.py => test_module.py} | 9 ++------- tox.ini | 3 ++- 4 files changed, 7 insertions(+), 19 deletions(-) rename tests/{test_account_credit_limit.py => test_module.py} (93%) diff --git a/setup.py b/setup.py index d89f746d5c..0f4137f5a4 100755 --- a/setup.py +++ b/setup.py @@ -138,13 +138,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_credit_limit = trytond.modules.account_credit_limit """, - test_suite='tests', - test_loader='trytond.test_loader:Loader', - tests_require=tests_require, ) diff --git a/tests/__init__.py b/tests/__init__.py index 6bb38c25c5..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_credit_limit.tests.test_account_credit_limit import \ - suite # noqa: E501 -except ImportError: - from .test_account_credit_limit import suite - -__all__ = ['suite'] diff --git a/tests/test_account_credit_limit.py b/tests/test_module.py similarity index 93% rename from tests/test_account_credit_limit.py rename to tests/test_module.py index e3d79cf1a7..bd5e4cc3a4 100644 --- a/tests/test_account_credit_limit.py +++ b/tests/test_module.py @@ -1,9 +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 decimal import Decimal -import trytond.tests.test_tryton from trytond.exceptions import UserError, UserWarning from trytond.modules.account.tests import create_chart, get_fiscalyear from trytond.modules.company.tests import ( @@ -81,8 +80,4 @@ class AccountCreditLimitTestCase(CompanyTestMixin, ModuleTestCase): Decimal(150), 'test') -def suite(): - suite = trytond.tests.test_tryton.suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase( - AccountCreditLimitTestCase)) - return suite +del ModuleTestCase diff --git a/tox.ini b/tox.ini index f0fed85bc1..ac1ba42b1b 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_credit_limit/* setup.py test + coverage run --include=.*/account_credit_limit/* -m unittest discover -s tests coverage report --include=.*/account_credit_limit/* --omit=*/tests/* deps = coverage