From e0b1ac3dafcdaba66f2d00797c11c2f043c55594 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 --- CHANGELOG | 1 + setup.py | 1 - tox.ini | 2 +- tryton/tests/__init__.py | 27 --------------------------- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f94fb0660d..0f883a7fc3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Use unittest discover * Support notification message * Add option to define logging output location * Remove TreeViewControl diff --git a/setup.py b/setup.py index 5bb84f5aad..74cee70044 100755 --- a/setup.py +++ b/setup.py @@ -160,6 +160,5 @@ dist = setup(name=name, }, dependency_links=dependency_links, zip_safe=False, - test_suite='tryton.tests', **args ) diff --git a/tox.ini b/tox.ini index c4e51f73af..7964b29cb5 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist = py37,py38,py39,py310 [testenv] commands = - coverage run setup.py test + coverage run -m unittest discover -s tryton.tests coverage report --include=./tryton/* --omit=*/tests/* deps = coverage diff --git a/tryton/tests/__init__.py b/tryton/tests/__init__.py index 758ec4a9ec..4effdfa4a2 100644 --- a/tryton/tests/__init__.py +++ b/tryton/tests/__init__.py @@ -1,29 +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. -import os -import sys -import unittest - - -def test_suite(): - suite = unittest.TestSuite() - loader = unittest.TestLoader() - for filename in os.listdir(os.path.dirname(__file__)): - if filename.startswith("test") and filename.endswith(".py"): - modname = "tryton.tests." + filename[:-3] - __import__(modname) - module = sys.modules[modname] - suite.addTests(loader.loadTestsFromModule(module)) - return suite - - -def main(): - suite = test_suite() - runner = unittest.TextTestRunner() - return runner.run(suite) - - -if __name__ == '__main__': - sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname( - os.path.abspath(__file__))))) - sys.exit(not main().wasSuccessful())