Skip to content
Snippets Groups Projects
Commit 32bdd16b authored by Cédric Krier's avatar Cédric Krier :atom:
Browse files

Replace test setuptools command by unittest discover

issue9215
review389851002
parent d23a0e03
No related branches found
No related tags found
1 merge request!114Return an empty list when the treeview has no selection
......@@ -138,9 +138,12 @@
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]
account_dunning_fee = trytond.modules.account_dunning_fee
""",
......@@ -141,10 +144,7 @@
dependency_links=dependency_links,
zip_safe=False,
entry_points="""
[trytond.modules]
account_dunning_fee = trytond.modules.account_dunning_fee
""",
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
)
# 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.account_dunning_fee.tests.test_account_dunning_fee import \
suite # noqa: E501
except ImportError:
from .test_account_dunning_fee import suite
__all__ = ['suite']
# 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 doctest
import unittest
from trytond.tests.test_tryton import (
ModuleTestCase, doctest_checker, doctest_teardown)
from trytond.tests.test_tryton import suite as test_suite
from trytond.tests.test_tryton import ModuleTestCase
class AccountDunningFeeTestCase(ModuleTestCase):
......@@ -15,13 +10,4 @@
extras = ['account_dunning_letter']
def suite():
suite = test_suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
AccountDunningFeeTestCase))
suite.addTests(doctest.DocFileSuite(
'scenario_account_dunning_fee.rst',
tearDown=doctest_teardown, encoding='utf-8',
checker=doctest_checker,
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite
del ModuleTestCase
# 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 doctest
import glob
import os
from trytond.tests.test_tryton import doctest_checker, doctest_teardown
def load_tests(loader, tests, pattern):
cwd = os.getcwd()
try:
os.chdir(os.path.dirname(__file__))
for scenario in glob.glob('*.rst'):
tests.addTests(doctest.DocFileSuite(
scenario, tearDown=doctest_teardown, encoding='utf-8',
checker=doctest_checker,
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
finally:
os.chdir(cwd)
return tests
......@@ -2,4 +2,5 @@
envlist = {py37,py38,py39,py310}-{sqlite,postgresql}
[testenv]
extras = test
commands =
......@@ -5,5 +6,5 @@
commands =
coverage run --include=.*/account_dunning_fee/* setup.py test
coverage run --include=.*/account_dunning_fee/* -m unittest discover -s tests
coverage report --include=.*/account_dunning_fee/* --omit=*/tests/*
deps =
coverage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment