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

Replace test setuptools command by unittest discover

issue9215
review389851002
parent 6b65c01a
No related branches found
No related tags found
1 merge request!114Return an empty list when the treeview has no selection
......@@ -144,9 +144,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_budget = trytond.modules.account_budget
""", # noqa: E501
......@@ -147,10 +150,7 @@
dependency_links=dependency_links,
zip_safe=False,
entry_points="""
[trytond.modules]
account_budget = trytond.modules.account_budget
""", # noqa: E501
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_budget.tests.test_account_budget import \
suite # noqa: E501
except ImportError:
from .test_account_budget 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.modules.company.tests import CompanyTestMixin
......@@ -7,7 +4,5 @@
from trytond.modules.company.tests import CompanyTestMixin
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 AccountBudgetTestCase(CompanyTestMixin, ModuleTestCase):
......@@ -15,13 +10,4 @@
module = 'account_budget'
def suite():
suite = test_suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
AccountBudgetTestCase))
suite.addTests(doctest.DocFileSuite(
'scenario_account_budget.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_budget/* setup.py test
coverage run --include=.*/account_budget/* -m unittest discover -s tests
coverage report --include=.*/account_budget/* --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