diff --git a/setup.py b/setup.py index 49f7989e17..d1730104d8 100755 --- a/setup.py +++ b/setup.py @@ -144,13 +144,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] product_image_attribute = trytond.modules.product_image_attribute """, # noqa: E501 - test_suite='tests', - test_loader='trytond.test_loader:Loader', - tests_require=tests_require, ) diff --git a/tests/__init__.py b/tests/__init__.py index 3b54054975..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.product_image_attribute.tests.test_product_image_attribute import \ - suite # noqa: E501 -except ImportError: - from .test_product_image_attribute import suite - -__all__ = ['suite'] diff --git a/tests/test_product_image_attribute.py b/tests/test_module.py similarity index 87% rename from tests/test_product_image_attribute.py rename to tests/test_module.py index c934a97408..9d602ae316 100644 --- a/tests/test_product_image_attribute.py +++ b/tests/test_module.py @@ -1,12 +1,9 @@ # 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 import urllib.request 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 +from trytond.tests.test_tryton import ModuleTestCase, with_transaction class ProductImageAttributeTestCase(ModuleTestCase): @@ -68,8 +65,4 @@ class ProductImageAttributeTestCase(ModuleTestCase): self.assertEqual(list(product.images_used), [image2, image1, image3]) -def suite(): - suite = test_suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase( - ProductImageAttributeTestCase)) - return suite +del ModuleTestCase diff --git a/tox.ini b/tox.ini index 291dea29f9..d03a3093dd 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=.*/product_image_attribute/* setup.py test + coverage run --include=.*/product_image_attribute/* -m unittest discover -s tests coverage report --include=.*/product_image_attribute/* --omit=*/tests/* deps = coverage