From d23aa560b4e65b08bf6e45e38c5fc4f9b0b95037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 16 Apr 2022 18:30:20 +0200 Subject: [PATCH] Replace test setuptools command by unittest discover issue9215 review389851002 --- setup.py | 2 -- tests/__init__.py | 8 -------- tests/{test_stock_supply_day.py => test_module.py} | 12 +++--------- tox.ini | 2 +- 4 files changed, 4 insertions(+), 20 deletions(-) rename tests/{test_stock_supply_day.py => test_module.py} (96%) diff --git a/setup.py b/setup.py index 23baeef539..2d68e1bb77 100755 --- a/setup.py +++ b/setup.py @@ -141,6 +141,4 @@ setup(name=name, [trytond.modules] stock_supply_day = trytond.modules.stock_supply_day """, - test_suite='tests', - test_loader='trytond.test_loader:Loader', ) diff --git a/tests/__init__.py b/tests/__init__.py index 4df5f15c13..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.stock_supply_day.tests.test_stock_supply_day import \ - suite # noqa: E501 -except ImportError: - from .test_stock_supply_day import suite - -__all__ = ['suite'] diff --git a/tests/test_stock_supply_day.py b/tests/test_module.py similarity index 96% rename from tests/test_stock_supply_day.py rename to tests/test_module.py index fae24eb333..7bd8742014 100644 --- a/tests/test_stock_supply_day.py +++ b/tests/test_module.py @@ -1,10 +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 datetime -import unittest -from decimal import Decimal -import trytond.tests.test_tryton +import datetime + from trytond.modules.account.tests import create_chart from trytond.modules.company.tests import ( CompanyTestMixin, create_company, set_company) @@ -153,8 +151,4 @@ class StockSupplyDayTestCase(CompanyTestMixin, ModuleTestCase): return product_supplier -def suite(): - suite = trytond.tests.test_tryton.suite() - suite.addTests(unittest.TestLoader().loadTestsFromTestCase( - StockSupplyDayTestCase)) - return suite +del ModuleTestCase diff --git a/tox.ini b/tox.ini index f4b6377177..dfd50f8197 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist = {py37,py38,py39,py310}-{sqlite,postgresql} [testenv] commands = - coverage run --include=.*/stock_supply_day/* setup.py test + coverage run --include=.*/stock_supply_day/* -m unittest discover -s tests coverage report --include=.*/stock_supply_day/* --omit=*/tests/* deps = coverage