From b42e734f9f48491b6dfab1e0eb30f2b16830a04e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 16 Apr 2022 18:30:19 +0200 Subject: [PATCH] Replace test setuptools command by unittest discover issue9215 review389851002 --- setup.py | 6 +++--- tests/__init__.py | 7 ------- tests/{test_stock_lot_sled.py => test_module.py} | 8 +------- tox.ini | 3 ++- 4 files changed, 6 insertions(+), 18 deletions(-) rename tests/{test_stock_lot_sled.py => test_module.py} (96%) diff --git a/setup.py b/setup.py index f16aa68300..ba9d2e73bb 100755 --- a/setup.py +++ b/setup.py @@ -136,13 +136,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] stock_lot_sled = trytond.modules.stock_lot_sled """, - test_suite='tests', - test_loader='trytond.test_loader:Loader', - tests_require=tests_require, ) diff --git a/tests/__init__.py b/tests/__init__.py index 90aa5de401..4effdfa4a2 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,9 +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.stock_lot_sled.tests.test_stock_lot_sled import suite -except ImportError: - from .test_stock_lot_sled import suite - -__all__ = ['suite'] diff --git a/tests/test_stock_lot_sled.py b/tests/test_module.py similarity index 96% rename from tests/test_stock_lot_sled.py rename to tests/test_module.py index 51b82410f4..9464ff3c3c 100644 --- a/tests/test_stock_lot_sled.py +++ b/tests/test_module.py @@ -1,9 +1,7 @@ # 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 -import trytond.tests.test_tryton from trytond.modules.company.tests import ( CompanyTestMixin, create_company, set_company) from trytond.pool import Pool @@ -160,8 +158,4 @@ class StockLotSLEDTestCase(CompanyTestMixin, ModuleTestCase): (repr(context), delay)) -def suite(): - suite = trytond.tests.test_tryton.suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase( - StockLotSLEDTestCase)) - return suite +del ModuleTestCase diff --git a/tox.ini b/tox.ini index 42a33f332a..03acfcd3a9 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=.*/stock_lot_sled/* setup.py test + coverage run --include=.*/stock_lot_sled/* -m unittest discover -s tests coverage report --include=.*/stock_lot_sled/* --omit=*/tests/* deps = coverage