changeset d13291ce4ed5 in modules/account_payment_sepa_cfonb:default
details: 
https://hg.tryton.org/modules/account_payment_sepa_cfonb?cmd=changeset&node=d13291ce4ed5
description:
        Replace test setuptools command by unittest discover

        issue9215
        review389851002
diffstat:

 setup.py                                 |   6 +++---
 tests/__init__.py                        |   8 --------
 tests/test_account_payment_sepa_cfonb.py |  32 --------------------------------
 tests/test_module.py                     |  26 ++++++++++++++++++++++++++
 tox.ini                                  |   3 ++-
 5 files changed, 31 insertions(+), 44 deletions(-)

diffs (114 lines):

diff -r c4f38327bd74 -r d13291ce4ed5 setup.py
--- a/setup.py  Sun Apr 10 19:11:37 2022 +0200
+++ b/setup.py  Sat Apr 16 18:30:16 2022 +0200
@@ -140,13 +140,13 @@
     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_payment_sepa_cfonb = trytond.modules.account_payment_sepa_cfonb
     """,
-    test_suite='tests',
-    test_loader='trytond.test_loader:Loader',
-    tests_require=tests_require,
     )
diff -r c4f38327bd74 -r d13291ce4ed5 tests/__init__.py
--- a/tests/__init__.py Sun Apr 10 19:11:37 2022 +0200
+++ b/tests/__init__.py Sat Apr 16 18:30:16 2022 +0200
@@ -1,10 +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.
-
-try:
-    from 
trytond.modules.account_payment_sepa_cfonb.tests.test_account_payment_sepa_cfonb
 import \
-        suite  # noqa: E501
-except ImportError:
-    from .test_account_payment_sepa_cfonb import suite
-
-__all__ = ['suite']
diff -r c4f38327bd74 -r d13291ce4ed5 tests/test_account_payment_sepa_cfonb.py
--- a/tests/test_account_payment_sepa_cfonb.py  Sun Apr 10 19:11:37 2022 +0200
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-# 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
-
-import trytond.tests.test_tryton
-from trytond.modules.account_payment_sepa.tests import validate_file
-from trytond.modules.company.tests import CompanyTestMixin
-from trytond.tests.test_tryton import ModuleTestCase, with_transaction
-
-
-class AccountPaymentSepaCFONBTestCase(CompanyTestMixin, ModuleTestCase):
-    'Test Account Payment SEPA CFONB module'
-    module = 'account_payment_sepa_cfonb'
-
-    @with_transaction()
-    def test_pain001_001_03_cfonb(self):
-        'Test pain.00r.001.03-cfonb xsd validation'
-        validate_file('pain.001.001.03-cfonb', 'payable',
-            xsd='pain.001.001.03')
-
-    @with_transaction()
-    def test_pain008_001_02_cfonb(self):
-        'Test pain.008.001.02-cfonb xsd validation'
-        validate_file('pain.008.001.02-cfonb', 'receivable',
-            xsd='pain.008.001.02')
-
-
-def suite():
-    suite = trytond.tests.test_tryton.suite()
-    suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
-            AccountPaymentSepaCFONBTestCase))
-    return suite
diff -r c4f38327bd74 -r d13291ce4ed5 tests/test_module.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_module.py      Sat Apr 16 18:30:16 2022 +0200
@@ -0,0 +1,26 @@
+# 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 trytond.modules.account_payment_sepa.tests import validate_file
+from trytond.modules.company.tests import CompanyTestMixin
+from trytond.tests.test_tryton import ModuleTestCase, with_transaction
+
+
+class AccountPaymentSepaCFONBTestCase(CompanyTestMixin, ModuleTestCase):
+    'Test Account Payment SEPA CFONB module'
+    module = 'account_payment_sepa_cfonb'
+
+    @with_transaction()
+    def test_pain001_001_03_cfonb(self):
+        'Test pain.00r.001.03-cfonb xsd validation'
+        validate_file('pain.001.001.03-cfonb', 'payable',
+            xsd='pain.001.001.03')
+
+    @with_transaction()
+    def test_pain008_001_02_cfonb(self):
+        'Test pain.008.001.02-cfonb xsd validation'
+        validate_file('pain.008.001.02-cfonb', 'receivable',
+            xsd='pain.008.001.02')
+
+
+del ModuleTestCase
diff -r c4f38327bd74 -r d13291ce4ed5 tox.ini
--- a/tox.ini   Sun Apr 10 19:11:37 2022 +0200
+++ b/tox.ini   Sat Apr 16 18:30:16 2022 +0200
@@ -2,8 +2,9 @@
 envlist = {py37,py38,py39,py310}-{sqlite,postgresql}
 
 [testenv]
+extras = test
 commands =
-    coverage run --include=.*/account_payment_sepa_cfonb/* setup.py test
+    coverage run --include=.*/account_payment_sepa_cfonb/* -m unittest 
discover -s tests
     coverage report --include=.*/account_payment_sepa_cfonb/* --omit=*/tests/*
 deps =
     coverage

Reply via email to