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

        issue9215
        review389851002
diffstat:

 setup.py                |   2 --
 tests/__init__.py       |   7 -------
 tests/test_dashboard.py |  28 ----------------------------
 tests/test_module.py    |  22 ++++++++++++++++++++++
 tox.ini                 |   2 +-
 5 files changed, 23 insertions(+), 38 deletions(-)

diffs (93 lines):

diff -r b8ec95384ff0 -r 35d0ca21ac07 setup.py
--- a/setup.py  Sun Apr 10 19:11:38 2022 +0200
+++ b/setup.py  Sat Apr 16 18:30:17 2022 +0200
@@ -140,6 +140,4 @@
     [trytond.modules]
     dashboard = trytond.modules.dashboard
     """,
-    test_suite='tests',
-    test_loader='trytond.test_loader:Loader',
     )
diff -r b8ec95384ff0 -r 35d0ca21ac07 tests/__init__.py
--- a/tests/__init__.py Sun Apr 10 19:11:38 2022 +0200
+++ b/tests/__init__.py Sat Apr 16 18:30:17 2022 +0200
@@ -1,9 +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.dashboard.tests.test_dashboard import suite
-except ImportError:
-    from .test_dashboard import suite
-
-__all__ = ['suite']
diff -r b8ec95384ff0 -r 35d0ca21ac07 tests/test_dashboard.py
--- a/tests/test_dashboard.py   Sun Apr 10 19:11:38 2022 +0200
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +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.pool import Pool
-from trytond.tests.test_tryton import ModuleTestCase, with_transaction
-
-
-class DashboardTestCase(ModuleTestCase):
-    'Test Dashboard module'
-    module = 'dashboard'
-
-    @with_transaction()
-    def test_view_read(self):
-        'Test dashboard view read'
-        pool = Pool()
-        View = pool.get('ir.ui.view')
-        dashboard_id = View.dashboard_id()
-        result, = View.read([dashboard_id], ['arch'])
-        self.assertIn('board', result['arch'])
-
-
-def suite():
-    suite = trytond.tests.test_tryton.suite()
-    suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
-        DashboardTestCase))
-    return suite
diff -r b8ec95384ff0 -r 35d0ca21ac07 tests/test_module.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test_module.py      Sat Apr 16 18:30:17 2022 +0200
@@ -0,0 +1,22 @@
+# 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.pool import Pool
+from trytond.tests.test_tryton import ModuleTestCase, with_transaction
+
+
+class DashboardTestCase(ModuleTestCase):
+    'Test Dashboard module'
+    module = 'dashboard'
+
+    @with_transaction()
+    def test_view_read(self):
+        'Test dashboard view read'
+        pool = Pool()
+        View = pool.get('ir.ui.view')
+        dashboard_id = View.dashboard_id()
+        result, = View.read([dashboard_id], ['arch'])
+        self.assertIn('board', result['arch'])
+
+
+del ModuleTestCase
diff -r b8ec95384ff0 -r 35d0ca21ac07 tox.ini
--- a/tox.ini   Sun Apr 10 19:11:38 2022 +0200
+++ b/tox.ini   Sat Apr 16 18:30:17 2022 +0200
@@ -3,7 +3,7 @@
 
 [testenv]
 commands =
-    coverage run --include=.*/dashboard/* setup.py test
+    coverage run --include=.*/dashboard/* -m unittest discover -s tests
     coverage report --include=.*/dashboard/* --omit=*/tests/*
 deps =
     coverage

Reply via email to