Replace test setuptools command by unittest discover
This commit is contained in:
parent
1a8c781e2e
commit
29b414891d
|
@ -1,6 +0,0 @@
|
|||
# This file is part party_company module for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from .test_party_company import suite
|
||||
|
||||
__all__ = ['suite', 'set_company']
|
|
@ -1,16 +1,13 @@
|
|||
# This file is part party_company module for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
import unittest
|
||||
import doctest
|
||||
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from contextlib import contextmanager
|
||||
import trytond.tests.test_tryton
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.tests.test_tryton import (doctest_setup, doctest_teardown,
|
||||
doctest_checker)
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.modules.company.tests import create_company
|
||||
from trytond.modules.company.tests import CompanyTestMixin, create_company
|
||||
|
||||
|
||||
@contextmanager
|
||||
def set_company(company):
|
||||
|
@ -24,8 +21,8 @@ def set_company(company):
|
|||
yield
|
||||
|
||||
|
||||
class PartyCompanyTestCase(ModuleTestCase):
|
||||
'Test Party Company module'
|
||||
class PartyCompanyTestCase(CompanyTestMixin, ModuleTestCase):
|
||||
'Test PartyCompany module'
|
||||
module = 'party_company'
|
||||
|
||||
@with_transaction()
|
||||
|
@ -78,12 +75,4 @@ class PartyCompanyTestCase(ModuleTestCase):
|
|||
self.assertEqual(user.companies[1] == company2, True)
|
||||
|
||||
|
||||
def suite():
|
||||
suite = trytond.tests.test_tryton.suite()
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
|
||||
PartyCompanyTestCase))
|
||||
suite.addTests(doctest.DocFileSuite('scenario_party_company.rst',
|
||||
setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
|
||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE,
|
||||
checker=doctest_checker))
|
||||
return suite
|
||||
del ModuleTestCase
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
# 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
|
Loading…
Reference in New Issue