From 153c95f2a1d508294dc350ca1d00c33d683274ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 16 Apr 2022 18:30:18 +0200 Subject: [PATCH] Replace test setuptools command by unittest discover issue9215 review389851002 --- setup.py | 6 +++--- tests/__init__.py | 8 -------- ...est_product_price_list_dates.py => test_module.py} | 11 ++--------- tox.ini | 3 ++- 4 files changed, 7 insertions(+), 21 deletions(-) rename tests/{test_product_price_list_dates.py => test_module.py} (87%) diff --git a/setup.py b/setup.py index ca374f38f0..08e1c231cb 100755 --- a/setup.py +++ b/setup.py @@ -139,13 +139,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_price_list_dates = trytond.modules.product_price_list_dates """, - test_suite='tests', - test_loader='trytond.test_loader:Loader', - tests_require=tests_require, ) diff --git a/tests/__init__.py b/tests/__init__.py index 7b751fa29a..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_price_list_dates.tests.test_product_price_list_dates import \ - suite # noqa: E501 -except ImportError: - from .test_product_price_list_dates import suite - -__all__ = ['suite'] diff --git a/tests/test_product_price_list_dates.py b/tests/test_module.py similarity index 87% rename from tests/test_product_price_list_dates.py rename to tests/test_module.py index 3ef2d3bce0..6386ec9c18 100644 --- a/tests/test_product_price_list_dates.py +++ b/tests/test_module.py @@ -2,15 +2,12 @@ # this repository contains the full copyright notices and license terms. import datetime -import unittest from decimal import Decimal from trytond.modules.company.tests import ( CompanyTestMixin, create_company, set_company) 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 ProductPriceListDatesTestCase(CompanyTestMixin, ModuleTestCase): @@ -76,8 +73,4 @@ class ProductPriceListDatesTestCase(CompanyTestMixin, ModuleTestCase): Decimal(9)) -def suite(): - suite = test_suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase( - ProductPriceListDatesTestCase)) - return suite +del ModuleTestCase diff --git a/tox.ini b/tox.ini index 9dca2510da..4ee7715a7c 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_price_list_dates/* setup.py test + coverage run --include=.*/product_price_list_dates/* -m unittest discover -s tests coverage report --include=.*/product_price_list_dates/* --omit=*/tests/* deps = coverage