changeset 3220cbb1cd1b in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset&node=3220cbb1cd1b
description:
Replace test setuptools command by unittest discover
issue9215
review389851002
diffstat:
CHANGELOG | 1 +
setup.py | 1 -
tox.ini | 2 +-
tryton/tests/__init__.py | 27 ---------------------------
4 files changed, 2 insertions(+), 29 deletions(-)
diffs (63 lines):
diff -r 0c84c8539ede -r 3220cbb1cd1b CHANGELOG
--- a/CHANGELOG Sat Apr 16 11:27:21 2022 +0200
+++ b/CHANGELOG Sat Apr 16 18:30:20 2022 +0200
@@ -1,3 +1,4 @@
+* Use unittest discover
* Support notification message
* Add option to define logging output location
* Remove TreeViewControl
diff -r 0c84c8539ede -r 3220cbb1cd1b setup.py
--- a/setup.py Sat Apr 16 11:27:21 2022 +0200
+++ b/setup.py Sat Apr 16 18:30:20 2022 +0200
@@ -160,6 +160,5 @@
},
dependency_links=dependency_links,
zip_safe=False,
- test_suite='tryton.tests',
**args
)
diff -r 0c84c8539ede -r 3220cbb1cd1b tox.ini
--- a/tox.ini Sat Apr 16 11:27:21 2022 +0200
+++ b/tox.ini Sat Apr 16 18:30:20 2022 +0200
@@ -3,7 +3,7 @@
[testenv]
commands =
- coverage run setup.py test
+ coverage run -m unittest discover -s tryton.tests
coverage report --include=./tryton/* --omit=*/tests/*
deps =
coverage
diff -r 0c84c8539ede -r 3220cbb1cd1b tryton/tests/__init__.py
--- a/tryton/tests/__init__.py Sat Apr 16 11:27:21 2022 +0200
+++ b/tryton/tests/__init__.py Sat Apr 16 18:30:20 2022 +0200
@@ -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())