diff --git a/setup.py b/setup.py index a5b8d7a0fe..052f8e9e21 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] authentication_sms = trytond.modules.authentication_sms """, - test_suite='tests', - test_loader='trytond.test_loader:Loader', - tests_require=tests_require, ) diff --git a/tests/__init__.py b/tests/__init__.py index f3a12f6cfa..f076cd9e87 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,10 +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. +from .test_module import send_sms -try: - from trytond.modules.authentication_sms.tests.test_authentication_sms import ( # noqa: E501 - send_sms, suite) -except ImportError: - from .test_authentication_sms import send_sms, suite - -__all__ = ['suite', 'send_sms'] +__all__ = ['send_sms'] diff --git a/tests/test_authentication_sms.py b/tests/test_module.py similarity index 94% rename from tests/test_authentication_sms.py rename to tests/test_module.py index 218ab3fc0a..44f55c07be 100644 --- a/tests/test_authentication_sms.py +++ b/tests/test_module.py @@ -1,13 +1,11 @@ # 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 datetime -import unittest from trytond.config import config from trytond.exceptions import LoginException from trytond.pool import Pool from trytond.tests.test_tryton import ModuleTestCase -from trytond.tests.test_tryton import suite as test_suite from trytond.tests.test_tryton import with_transaction @@ -117,8 +115,4 @@ class AuthenticationSMSTestCase(ModuleTestCase): self.assertEqual(user_id, user.id) -def suite(): - suite = test_suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase( - AuthenticationSMSTestCase)) - return suite +del ModuleTestCase diff --git a/tox.ini b/tox.ini index 2d84c84388..625ca3c572 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=.*/authentication_sms/* setup.py test + coverage run --include=.*/authentication_sms/* -m unittest discover -s tests coverage report --include=.*/authentication_sms/* --omit=*/tests/* deps = coverage