Replace test setuptools command by unittest discover

issue9215
review389851002
This commit is contained in:
Cédric Krier
2022-04-16 18:30:17 +02:00
parent a6fc01d78a
commit 9f6412057e
4 changed files with 8 additions and 22 deletions
-2
View File
@@ -149,6 +149,4 @@ setup(name=name,
[trytond.modules]
company = trytond.modules.company
""",
test_suite='tests',
test_loader='trytond.test_loader:Loader',
)
+4 -10
View File
@@ -1,15 +1,9 @@
# 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.company.tests.test_company import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company,
create_employee, set_company, suite)
except ImportError:
from .test_company import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company,
create_employee, set_company, suite)
from .test_module import (
CompanyTestMixin, PartyCompanyCheckEraseMixin, create_company,
create_employee, set_company)
__all__ = [
'suite', 'create_company', 'set_company', 'create_employee',
'create_company', 'set_company', 'create_employee',
'PartyCompanyCheckEraseMixin', 'CompanyTestMixin']
@@ -1,11 +1,11 @@
# 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 unittest
from collections import defaultdict
from contextlib import contextmanager
import trytond.tests.test_tryton
from trytond.model import ModelStorage, ModelView
from trytond.modules.company.model import CompanyMultiValueMixin
from trytond.modules.currency.tests import add_currency_rate, create_currency
from trytond.modules.party.tests import PartyCheckEraseMixin
from trytond.pool import Pool, isregisteredby
@@ -13,8 +13,6 @@ from trytond.pyson import Eval, PYSONEncoder
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.transaction import Transaction
from ..model import CompanyMultiValueMixin
def create_company(name='Dunder Mifflin', currency=None):
pool = Pool()
@@ -299,8 +297,4 @@ class CompanyTestCase(
self.assertEqual(root.employee, employee)
def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
CompanyTestCase))
return suite
del ModuleTestCase
+1 -1
View File
@@ -3,7 +3,7 @@ envlist = {py37,py38,py39,py310}-{sqlite,postgresql}
[testenv]
commands =
coverage run --include=.*/company/* setup.py test
coverage run --include=.*/company/* -m unittest discover -s tests
coverage report --include=.*/company/* --omit=*/tests/*
deps =
coverage