details:   https://code.tryton.org/tryton/commit/6820530c40b6
branch:    default
user:      Cédric Krier <[email protected]>
date:      Sat Sep 12 00:31:43 2026 +0200
description:
        Make DBTestCase public
diffstat:

 trytond/CHANGELOG                                  |   1 +
 trytond/doc/ref/tests.rst                          |  22 +++++++++----
 trytond/trytond/tests/test_access.py               |  27 ++++------------
 trytond/trytond/tests/test_backend.py              |  11 +-----
 trytond/trytond/tests/test_bus.py                  |  10 +----
 trytond/trytond/tests/test_cache.py                |  26 ++++-----------
 trytond/trytond/tests/test_chat.py                 |  10 +----
 trytond/trytond/tests/test_copy.py                 |  11 +-----
 trytond/trytond/tests/test_exportdata.py           |  11 +-----
 trytond/trytond/tests/test_field_binary.py         |  11 +-----
 trytond/trytond/tests/test_field_boolean.py        |  11 +-----
 trytond/trytond/tests/test_field_char.py           |  30 ++++--------------
 trytond/trytond/tests/test_field_context.py        |  11 +-----
 trytond/trytond/tests/test_field_date.py           |  11 +-----
 trytond/trytond/tests/test_field_datetime.py       |  11 +-----
 trytond/trytond/tests/test_field_depends.py        |  11 +-----
 trytond/trytond/tests/test_field_dict.py           |  16 ++-------
 trytond/trytond/tests/test_field_float.py          |  11 +-----
 trytond/trytond/tests/test_field_fmany2one.py      |  11 +-----
 trytond/trytond/tests/test_field_function.py       |  11 +-----
 trytond/trytond/tests/test_field_integer.py        |  11 +-----
 trytond/trytond/tests/test_field_many2many.py      |  19 +++--------
 trytond/trytond/tests/test_field_many2one.py       |  27 ++++------------
 trytond/trytond/tests/test_field_multiselection.py |  11 +-----
 trytond/trytond/tests/test_field_numeric.py        |  11 +-----
 trytond/trytond/tests/test_field_one2many.py       |  35 +++++----------------
 trytond/trytond/tests/test_field_one2one.py        |  11 +-----
 trytond/trytond/tests/test_field_reference.py      |  11 +-----
 trytond/trytond/tests/test_field_selection.py      |  11 +-----
 trytond/trytond/tests/test_field_text.py           |  22 ++++---------
 trytond/trytond/tests/test_field_time.py           |  11 +-----
 trytond/trytond/tests/test_field_timedelta.py      |  11 +-----
 trytond/trytond/tests/test_history.py              |  11 +-----
 trytond/trytond/tests/test_i18n.py                 |  11 +-----
 trytond/trytond/tests/test_importdata.py           |  11 +-----
 trytond/trytond/tests/test_ir.py                   |  17 +--------
 trytond/trytond/tests/test_mixins.py               |  27 ++++------------
 trytond/trytond/tests/test_model.py                |  15 +++------
 trytond/trytond/tests/test_model_log.py            |  10 +----
 trytond/trytond/tests/test_modelsingleton.py       |  11 +-----
 trytond/trytond/tests/test_modelsql.py             |  16 +++------
 trytond/trytond/tests/test_modelstorage.py         |  27 ++++------------
 trytond/trytond/tests/test_modelview.py            |  11 +-----
 trytond/trytond/tests/test_mptt.py                 |  11 +-----
 trytond/trytond/tests/test_multivalue.py           |  11 +-----
 trytond/trytond/tests/test_order.py                |  11 +-----
 trytond/trytond/tests/test_path.py                 |   5 +-
 trytond/trytond/tests/test_report.py               |  11 +-----
 trytond/trytond/tests/test_resource.py             |  11 +-----
 trytond/trytond/tests/test_routing.py              |  15 +++------
 trytond/trytond/tests/test_rpc.py                  |  11 +-----
 trytond/trytond/tests/test_rule.py                 |  11 +-----
 trytond/trytond/tests/test_sendmail.py             |  10 +----
 trytond/trytond/tests/test_sequence.py             |  11 +-----
 trytond/trytond/tests/test_transaction.py          |  11 +-----
 trytond/trytond/tests/test_tree.py                 |  24 +++-----------
 trytond/trytond/tests/test_trigger.py              |  11 +-----
 trytond/trytond/tests/test_tryton.py               |  11 +++---
 trytond/trytond/tests/test_union.py                |  11 +-----
 trytond/trytond/tests/test_user.py                 |  11 +-----
 trytond/trytond/tests/test_wizard.py               |  11 +-----
 trytond/trytond/tests/test_workflow.py             |  11 +-----
 62 files changed, 245 insertions(+), 606 deletions(-)

diffs (2048 lines):

diff -r 7df15278c979 -r 6820530c40b6 trytond/CHANGELOG
--- a/trytond/CHANGELOG Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/CHANGELOG Sat Sep 12 00:31:43 2026 +0200
@@ -1,3 +1,4 @@
+* Make DBTestCase public
 * Add function to import XML files
 * Add support for router in Pool
 * Add explicit request context in URLAccessor
diff -r 7df15278c979 -r 6820530c40b6 trytond/doc/ref/tests.rst
--- a/trytond/doc/ref/tests.rst Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/doc/ref/tests.rst Sat Sep 12 00:31:43 2026 +0200
@@ -48,17 +48,17 @@
    It setups warning filters based on ``TEST_PYTHONWARNINGS`` environment
    variable.
 
-ModuleTestCase
---------------
+DBTestCase
+----------
 
-.. class:: ModuleTestCase()
+.. class:: DBTestCase()
 
-   A subclass of :class:`TestCase` that tests a Tryton module.
-   Some tests are included to ensure that the module works properly.
+   A subclass of :class:`TestCase` for testing a Tryton module.
 
    It creates a temporary database with the module activated in setUpClass_ and
    drops it in the tearDownClass_ method.
 
+
 .. attribute:: ModuleTestCase.module
 
    Name of the tested module.
@@ -72,6 +72,14 @@
    The language to activate.
    Default value is ``en``.
 
+ModuleTestCase
+--------------
+
+.. class:: ModuleTestCase()
+
+   A subclass of :class:`DBTestCase` that tests a Tryton module.
+   Some tests are included to ensure that the module works properly.
+
 RouteTestCase
 -------------
 
@@ -114,8 +122,8 @@
 
 .. class:: ExtensionTestCase()
 
-   A subclass of :class:`TestCase` to test a Tryton with an database extension
-   activated.
+   A subclass of :class:`DBTestCase` to test a Tryton with an database
+   extension activated.
 
 .. attribute:: ExtensionTestCase.extension
 
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_access.py
--- a/trytond/trytond/tests/test_access.py      Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_access.py      Sat Sep 12 00:31:43 2026 +0200
@@ -5,21 +5,16 @@
 from trytond.model import ModelAccessProxy
 from trytond.model.exceptions import AccessError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 _context = {'_check_access': True}
 
 
-class _ModelAccessTestCase(TestCase):
+class _ModelAccessTestCase(DBTestCase):
+    module = 'tests'
     _perm = None
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     model_name = model_access_name = 'test.access'
 
     @property
@@ -489,14 +484,10 @@
             TestAccess.search([])
 
 
-class _ModelFieldAccessTestCase(TestCase):
+class _ModelFieldAccessTestCase(DBTestCase):
+    module = 'tests'
     _perm = None
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     @property
     def group(self):
         pool = Pool()
@@ -1193,12 +1184,8 @@
             TestAccess.write([record], {'field2': 'test'})
 
 
-class MenuActionAccessReadTestCase(TestCase):
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+class MenuActionAccessReadTestCase(DBTestCase):
+    module = 'tests'
 
     def create_menu(self, access=None):
         pool = Pool()
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_backend.py
--- a/trytond/trytond/tests/test_backend.py     Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_backend.py     Sat Sep 12 00:31:43 2026 +0200
@@ -11,19 +11,14 @@
 from trytond.model import fields
 from trytond.sql.functions import NumRange
 from trytond.sql.operators import RangeContain, RangeIn, RangeOverlap
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.tools import sqlite_apply_types
 from trytond.transaction import Transaction
 
 
-class BackendTestCase(TestCase):
+class BackendTestCase(DBTestCase):
     "Test the backend"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_current_timestamp_static_transaction(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_bus.py
--- a/trytond/trytond/tests/test_bus.py Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_bus.py Sat Sep 12 00:31:43 2026 +0200
@@ -8,7 +8,7 @@
 from trytond import backend, config
 from trytond.bus import Bus, _MessageQueue, notify
 from trytond.tests.test_tryton import (
-    DB_NAME, TestCase, activate_module, with_transaction)
+    DB_NAME, DBTestCase, TestCase, with_transaction)
 from trytond.transaction import Transaction
 
 
@@ -74,13 +74,9 @@
         self.assertEqual(content, {'message_id': 10})
 
 
-class BusTestCase(TestCase):
+class BusTestCase(DBTestCase):
     "Test Bus"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('ir')
+    module = 'ir'
 
     def setUp(self):
         super().setUp()
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_cache.py
--- a/trytond/trytond/tests/test_cache.py       Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_cache.py       Sat Sep 12 00:31:43 2026 +0200
@@ -11,7 +11,7 @@
     REFRESH_POOL_MSG, LRUDict, LRUDictTransaction, MemoryCache, freeze,
     unfreeze)
 from trytond.tests.test_tryton import (
-    DB_NAME, USER, TestCase, activate_module, with_transaction)
+    DB_NAME, USER, DBTestCase, TestCase, with_transaction)
 from trytond.transaction import Transaction
 
 cache = MemoryCache('test.cache')
@@ -21,13 +21,9 @@
 cache_ignored_global_context = MemoryCache('test.cache.ignored.global')
 
 
-class CacheTestCase(TestCase):
+class CacheTestCase(DBTestCase):
     "Test Cache"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def testFreeze(self):
         "Test freeze"
@@ -96,13 +92,9 @@
         self.assertEqual(value, 1)
 
 
-class MemoryCacheTestCase(TestCase):
+class MemoryCacheTestCase(DBTestCase):
     "Test Cache"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def setUp(self):
         super().setUp()
@@ -328,13 +320,9 @@
         self.assertEqual(lru_dict['foo'], 'foo')
 
 
-class LRUDictTransactionTestCase(TestCase):
+class LRUDictTransactionTestCase(DBTestCase):
     "Test LRUDictTransaction"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_init(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_chat.py
--- a/trytond/trytond/tests/test_chat.py        Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_chat.py        Sat Sep 12 00:31:43 2026 +0200
@@ -10,16 +10,12 @@
 from trytond.tools import file_open
 from trytond.transaction import Transaction
 
-from .test_tryton import TestCase, activate_module, with_transaction
+from .test_tryton import DBTestCase, with_transaction
 
 
-class NotificationTestCase(TestCase):
+class NotificationTestCase(DBTestCase):
     "Test Notification"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def run_tasks(self):
         pool = Pool()
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_copy.py
--- a/trytond/trytond/tests/test_copy.py        Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_copy.py        Sat Sep 12 00:31:43 2026 +0200
@@ -7,20 +7,15 @@
 from trytond.model import fields
 from trytond.model.exceptions import AccessError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 from .test_modelsql import TranslationTestCase
 
 
-class CopyTestCase(TestCase):
+class CopyTestCase(DBTestCase):
     'Test copy'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_copy(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_exportdata.py
--- a/trytond/trytond/tests/test_exportdata.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_exportdata.py  Sat Sep 12 00:31:43 2026 +0200
@@ -7,18 +7,13 @@
 
 from trytond.model.exceptions import AccessError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class ExportDataTestCase(TestCase):
+class ExportDataTestCase(DBTestCase):
     'Test export_data'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_boolean(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_binary.py
--- a/trytond/trytond/tests/test_field_binary.py        Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_binary.py        Sat Sep 12 00:31:43 
2026 +0200
@@ -11,20 +11,15 @@
 from trytond.model.exceptions import (
     RequiredValidationError, SQLConstraintError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 cast = fields.Binary.cast
 
 
-class FieldBinaryTestCase(TestCase):
+class FieldBinaryTestCase(DBTestCase):
     "Test Field Binary"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def setUp(self):
         super().setUp()
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_boolean.py
--- a/trytond/trytond/tests/test_field_boolean.py       Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_boolean.py       Sat Sep 12 00:31:43 
2026 +0200
@@ -4,17 +4,12 @@
 from sql import Literal
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldBooleanTestCase(TestCase):
+class FieldBooleanTestCase(DBTestCase):
     "Test Field Boolean"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_char.py
--- a/trytond/trytond/tests/test_field_char.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_field_char.py  Sat Sep 12 00:31:43 2026 +0200
@@ -10,7 +10,7 @@
     ForbiddenCharValidationError, RequiredValidationError, SizeValidationError)
 from trytond.pool import Pool
 from trytond.tests.test_tryton import (
-    ExtensionTestCase, TestCase, activate_module, with_transaction)
+    DBTestCase, ExtensionTestCase, with_transaction)
 from trytond.transaction import Transaction
 
 
@@ -426,13 +426,9 @@
         self.assertEqual(char.char_unstripped, " Foo ")
 
 
-class FieldCharTestCase(TestCase, CommonTestCaseMixin):
+class FieldCharTestCase(DBTestCase, CommonTestCaseMixin):
     "Test Field Char"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def Char(self):
         return Pool().get('test.char')
@@ -653,13 +649,9 @@
         self.assertEqual(read_record.char_unstripped, " Bar ")
 
 
-class FieldCharTranslatedTestCase(TestCase, CommonTestCaseMixin):
+class FieldCharTranslatedTestCase(DBTestCase, CommonTestCaseMixin):
     "Test Field Char Translated"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def Char(self):
         return Pool().get('test.char_translate')
@@ -725,13 +717,9 @@
     "unaccent works only on postgresql")
 class FieldCharUnaccentedTestCase(ExtensionTestCase):
     "Test Field Char with unaccented searches"
+    module = 'tests'
     extension = 'unaccent'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     @with_transaction()
     def test_normal_search(self):
         "Test searches without the unaccented feature"
@@ -805,13 +793,9 @@
     "similarity works only on postgresql")
 class FieldCharSimilarityTestCase(ExtensionTestCase):
     "Test Field Char with similarity searches"
+    module = 'tests'
     extension = 'pg_trgm'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def _test_search(self, Model):
         record1, record2 = Model.create([{
                     'char': "word",
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_context.py
--- a/trytond/trytond/tests/test_field_context.py       Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_context.py       Sat Sep 12 00:31:43 
2026 +0200
@@ -2,17 +2,12 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldContextTestCase(TestCase):
+class FieldContextTestCase(DBTestCase):
     "Test context on field"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_context(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_date.py
--- a/trytond/trytond/tests/test_field_date.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_field_date.py  Sat Sep 12 00:31:43 2026 +0200
@@ -9,8 +9,7 @@
 from trytond import backend
 from trytond.model.exceptions import RequiredValidationError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 today = datetime.date(2009, 1, 1)
@@ -19,13 +18,9 @@
 default_date = datetime.date(2000, 1, 1)
 
 
-class FieldDateTestCase(TestCase):
+class FieldDateTestCase(DBTestCase):
     "Test Field Date"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_set_string(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_datetime.py
--- a/trytond/trytond/tests/test_field_datetime.py      Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_datetime.py      Sat Sep 12 00:31:43 
2026 +0200
@@ -7,8 +7,7 @@
 from trytond.model.exceptions import (
     RequiredValidationError, TimeFormatValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 today = datetime.datetime(2009, 1, 1, 12, 0, 0)
 tomorrow = today + datetime.timedelta(1)
@@ -16,13 +15,9 @@
 default_datetime = datetime.datetime(2000, 1, 1, 12, 0, 0)
 
 
-class FieldDateTimeTestCase(TestCase):
+class FieldDateTimeTestCase(DBTestCase):
     "Test Field DateTime"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_set_string(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_depends.py
--- a/trytond/trytond/tests/test_field_depends.py       Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_depends.py       Sat Sep 12 00:31:43 
2026 +0200
@@ -3,17 +3,12 @@
 
 from trytond.model import ModelView, fields
 from trytond.pyson import Eval, If
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldDependsTestCase(TestCase):
+class FieldDependsTestCase(DBTestCase):
     'Test Field Depends'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def test_empty_depends(self):
         'Test depends are set if empty'
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_dict.py
--- a/trytond/trytond/tests/test_field_dict.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_field_dict.py  Sat Sep 12 00:31:43 2026 +0200
@@ -7,16 +7,12 @@
 from trytond.model.exceptions import RequiredValidationError
 from trytond.pool import Pool
 from trytond.tests.test_tryton import (
-    ExtensionTestCase, TestCase, activate_module, with_transaction)
+    DBTestCase, ExtensionTestCase, with_transaction)
 
 
-class FieldDictTestCase(TestCase):
+class FieldDictTestCase(DBTestCase):
     "Test Field Dict"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def create_schema(self):
         DictSchema = Pool().get('test.dict.schema')
@@ -878,13 +874,9 @@
     "unaccent works only on postgresql")
 class FieldDictUnaccentedTestCase(ExtensionTestCase):
     "Test Field Dict with unaccented searched"
+    module = 'tests'
     extension = 'unaccent'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     @with_transaction()
     def test_search_unaccented_off(self):
         "Test searches without the unaccented feature"
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_float.py
--- a/trytond/trytond/tests/test_field_float.py Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_field_float.py Sat Sep 12 00:31:43 2026 +0200
@@ -6,17 +6,12 @@
 from trytond.model.exceptions import (
     DigitsValidationError, RequiredValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldFloatTestCase(TestCase):
+class FieldFloatTestCase(DBTestCase):
     "Test Field Float"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_fmany2one.py
--- a/trytond/trytond/tests/test_field_fmany2one.py     Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_fmany2one.py     Sat Sep 12 00:31:43 
2026 +0200
@@ -2,17 +2,12 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldFMany2OneTestCase(TestCase):
+class FieldFMany2OneTestCase(DBTestCase):
     "Test Field fmany2one"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_function.py
--- a/trytond/trytond/tests/test_field_function.py      Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_function.py      Sat Sep 12 00:31:43 
2026 +0200
@@ -4,18 +4,13 @@
 from unittest.mock import patch
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class FieldFunctionTestCase(TestCase):
+class FieldFunctionTestCase(DBTestCase):
     "Test Field Function"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_definition(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_integer.py
--- a/trytond/trytond/tests/test_field_integer.py       Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_integer.py       Sat Sep 12 00:31:43 
2026 +0200
@@ -6,17 +6,12 @@
 from trytond.model.exceptions import (
     DomainValidationError, RequiredValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldIntegerTestCase(TestCase):
+class FieldIntegerTestCase(DBTestCase):
     "Test Field Integer"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_many2many.py
--- a/trytond/trytond/tests/test_field_many2many.py     Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_many2many.py     Sat Sep 12 00:31:43 
2026 +0200
@@ -4,8 +4,7 @@
 from trytond.model.exceptions import (
     DomainValidationError, RequiredValidationError, SizeValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
 class CommonTestCaseMixin:
@@ -416,13 +415,9 @@
         self.assertIsNone(relation.write_date)
 
 
-class FieldMany2ManyTestCase(TestCase, CommonTestCaseMixin):
+class FieldMany2ManyTestCase(DBTestCase, CommonTestCaseMixin):
     "Test Field Many2Many"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def Many2Many(self):
         return Pool().get('test.many2many')
@@ -826,13 +821,9 @@
             sorted([t.id for t in targets], reverse=True))
 
 
-class FieldMany2ManyReferenceTestCase(TestCase, CommonTestCaseMixin):
+class FieldMany2ManyReferenceTestCase(DBTestCase, CommonTestCaseMixin):
     "Test Field Many2Many Reference"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def Many2Many(self):
         return Pool().get('test.many2many_reference')
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_many2one.py
--- a/trytond/trytond/tests/test_field_many2one.py      Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_many2one.py      Sat Sep 12 00:31:43 
2026 +0200
@@ -9,8 +9,7 @@
 import trytond.config as config
 from trytond.model.exceptions import DomainValidationError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
 class CommonTestCaseMixin:
@@ -355,26 +354,18 @@
 
 
 class FieldMany2OneTestCase(
-        TestCase, CommonTestCaseMixin, SearchTestCaseMixin):
+        DBTestCase, CommonTestCaseMixin, SearchTestCaseMixin):
     "Test Field Many2One"
+    module = 'tests'
     _strategy = 'IN'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
 
 class FieldMany2OneExistsTestCase(
-        TestCase, CommonTestCaseMixin, SearchTestCaseMixin):
+        DBTestCase, CommonTestCaseMixin, SearchTestCaseMixin):
     "Test Field Many2One"
+    module = 'tests'
     _strategy = 'EXISTS'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def setUp(self):
         super().setUp()
         previous = config.get('database', 'subquery_threshold')
@@ -382,15 +373,11 @@
         self.addCleanup(config.set, 'database', 'subquery_threshold', previous)
 
 
-class FieldMany2OneTreeTestCase(TestCase):
+class FieldMany2OneTreeTestCase(DBTestCase):
     "Test Field Many2One Tree"
+    module = 'tests'
     model_name = 'test.many2one_tree'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def create_tree(self, Many2One):
         self.root1, self.root2 = Many2One.create([{}, {}])
         self.first1, self.first2, self.first3, self.first4 = Many2One.create([
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_multiselection.py
--- a/trytond/trytond/tests/test_field_multiselection.py        Thu Sep 03 
17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_field_multiselection.py        Sat Sep 12 
00:31:43 2026 +0200
@@ -4,17 +4,12 @@
 from trytond.model.exceptions import (
     RequiredValidationError, SelectionValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldMultiSelectionTestCase(TestCase):
+class FieldMultiSelectionTestCase(DBTestCase):
     "Test Field MultiSelection"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @property
     def Selection(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_numeric.py
--- a/trytond/trytond/tests/test_field_numeric.py       Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_numeric.py       Sat Sep 12 00:31:43 
2026 +0200
@@ -8,17 +8,12 @@
 from trytond.model.exceptions import (
     DigitsValidationError, RequiredValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldNumericTestCase(TestCase):
+class FieldNumericTestCase(DBTestCase):
     "Test Field Numeric"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_one2many.py
--- a/trytond/trytond/tests/test_field_one2many.py      Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_one2many.py      Sat Sep 12 00:31:43 
2026 +0200
@@ -5,8 +5,7 @@
 from trytond.model.exceptions import (
     DomainValidationError, RequiredValidationError, SizeValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
 class SearchTestCaseMixin:
@@ -490,15 +489,11 @@
 
 
 class FieldOne2ManyTestCase(
-        TestCase, CommonTestCaseMixin, SearchTestCaseMixin):
+        DBTestCase, CommonTestCaseMixin, SearchTestCaseMixin):
     "Test Field One2Many"
+    module = 'tests'
     _strategy = 'IN'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def One2Many(self):
         return Pool().get('test.one2many')
 
@@ -778,15 +773,11 @@
 
 
 class FieldOne2ManyReferenceTestCase(
-        TestCase, CommonTestCaseMixin, SearchTestCaseMixin):
+        DBTestCase, CommonTestCaseMixin, SearchTestCaseMixin):
     "Test Field One2Many Reference"
+    module = 'tests'
     _strategy = 'IN'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def One2Many(self):
         return Pool().get('test.one2many_reference')
 
@@ -797,15 +788,11 @@
         return Pool().get('test.one2many_reference.active')
 
 
-class FieldOne2ManyExistsTestCase(TestCase, SearchTestCaseMixin):
+class FieldOne2ManyExistsTestCase(DBTestCase, SearchTestCaseMixin):
     "Test Field One2Many when using EXISTS"
+    module = 'tests'
     _strategy = 'EXISTS'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def setUp(self):
         super().setUp()
         previous = config.get('database', 'subquery_threshold')
@@ -823,15 +810,11 @@
 
 
 class FieldOne2ManyReferenceExistsTestCase(
-        TestCase, SearchTestCaseMixin):
+        DBTestCase, SearchTestCaseMixin):
     "Test Field One2Many Reference when using EXISTS"
+    module = 'tests'
     _strategy = 'EXISTS'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def setUp(self):
         super().setUp()
         previous = config.get('database', 'subquery_threshold')
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_one2one.py
--- a/trytond/trytond/tests/test_field_one2one.py       Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_one2one.py       Sat Sep 12 00:31:43 
2026 +0200
@@ -6,17 +6,12 @@
 from trytond.model.exceptions import (
     DomainValidationError, RequiredValidationError, SQLConstraintError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldOne2OneTestCase(TestCase):
+class FieldOne2OneTestCase(DBTestCase):
     "Test Field One2One"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create_id(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_reference.py
--- a/trytond/trytond/tests/test_field_reference.py     Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_reference.py     Sat Sep 12 00:31:43 
2026 +0200
@@ -6,17 +6,12 @@
 from trytond.model.exceptions import (
     DomainValidationError, RequiredValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldReferenceTestCase(TestCase):
+class FieldReferenceTestCase(DBTestCase):
     "Test Field Reference"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_selection.py
--- a/trytond/trytond/tests/test_field_selection.py     Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_selection.py     Sat Sep 12 00:31:43 
2026 +0200
@@ -4,17 +4,12 @@
 from trytond.model.exceptions import (
     RequiredValidationError, SelectionValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class FieldSelectionTestCase(TestCase):
+class FieldSelectionTestCase(DBTestCase):
     "Test Field Selection"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_text.py
--- a/trytond/trytond/tests/test_field_text.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_field_text.py  Sat Sep 12 00:31:43 2026 +0200
@@ -7,8 +7,7 @@
 from trytond.model.exceptions import (
     RequiredValidationError, SizeValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
@@ -418,13 +417,9 @@
         self.assertEqual(text.text, "é")
 
 
-class FieldTextTestCase(TestCase, CommonTestCaseMixin):
+class FieldTextTestCase(DBTestCase, CommonTestCaseMixin):
     "Test Field Text"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def Text(self):
         return Pool().get('test.text')
@@ -540,20 +535,17 @@
                     })
 
 
-class FieldTextTranslatedTestCase(TestCase, CommonTestCaseMixin):
+class FieldTextTranslatedTestCase(DBTestCase, CommonTestCaseMixin):
     "Test Field Text Translated"
+    module = 'tests'
 
     def Text(self):
         return Pool().get('test.text_translate')
 
 
-class FieldFullTextTestCase(TestCase):
+class FieldFullTextTestCase(DBTestCase):
     "Test Field FullText"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_field_time.py
--- a/trytond/trytond/tests/test_field_time.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_field_time.py  Sat Sep 12 00:31:43 2026 +0200
@@ -7,8 +7,7 @@
 from trytond.model.exceptions import (
     RequiredValidationError, TimeFormatValidationError)
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 pre_evening = datetime.time(16, 30)
 evening = datetime.time(18, 45, 3)
@@ -16,13 +15,9 @@
 default_time = datetime.time(16, 30)
 
 
-class FieldTimeTestCase(TestCase):
+class FieldTimeTestCase(DBTestCase):
     "Test Field Time"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_set_string(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_field_timedelta.py
--- a/trytond/trytond/tests/test_field_timedelta.py     Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_field_timedelta.py     Sat Sep 12 00:31:43 
2026 +0200
@@ -4,8 +4,7 @@
 
 from trytond.model.exceptions import RequiredValidationError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 minute = datetime.timedelta(minutes=1)
 hour = datetime.timedelta(hours=1)
@@ -13,13 +12,9 @@
 default_timedelta = datetime.timedelta(seconds=3600)
 
 
-class FieldTimeDeltaTestCase(TestCase):
+class FieldTimeDeltaTestCase(DBTestCase):
     "Test Field TimeDelta"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_set_string(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_history.py
--- a/trytond/trytond/tests/test_history.py     Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_history.py     Sat Sep 12 00:31:43 2026 +0200
@@ -6,18 +6,13 @@
 from trytond import backend
 from trytond.model.exceptions import AccessError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class HistoryTestCase(TestCase):
+class HistoryTestCase(DBTestCase):
     'Test History'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def tearDown(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_i18n.py
--- a/trytond/trytond/tests/test_i18n.py        Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_i18n.py        Sat Sep 12 00:31:43 2026 +0200
@@ -5,18 +5,13 @@
 
 from trytond.i18n import gettext, lazy_gettext, lazy_ngettext, ngettext
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.tools.string_ import LazyString
 
 
-class I18nTestCase(TestCase):
+class I18nTestCase(DBTestCase):
     'Test Model Access'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_gettext_with_translation(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_importdata.py
--- a/trytond/trytond/tests/test_importdata.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_importdata.py  Sat Sep 12 00:31:43 2026 +0200
@@ -6,18 +6,13 @@
 
 from trytond.model.exceptions import ImportDataError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class ImportDataTestCase(TestCase):
+class ImportDataTestCase(DBTestCase):
     'Test import_data'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_missing_values(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_ir.py
--- a/trytond/trytond/tests/test_ir.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_ir.py  Sat Sep 12 00:31:43 2026 +0200
@@ -25,8 +25,7 @@
 from trytond.tools import file_open, timezone
 from trytond.transaction import Transaction
 
-from .test_tryton import (
-    ModuleTestCase, TestCase, activate_module, drop_db, with_transaction)
+from .test_tryton import DBTestCase, ModuleTestCase, with_transaction
 
 
 class IrTestCase(ModuleTestCase):
@@ -792,19 +791,9 @@
         self.assertEqual(filename, "Workflow Graph")
 
 
-class IrCronTestCase(TestCase):
+class IrCronTestCase(DBTestCase):
     "Test ir.cron features"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        drop_db()
-        activate_module(['ir'])
-
-    @classmethod
-    def tearDownClass(cls):
-        super().tearDownClass()
-        drop_db()
+    module = 'ir'
 
     def setUp(self):
         server_tz = timezone.SERVER
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_mixins.py
--- a/trytond/trytond/tests/test_mixins.py      Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_mixins.py      Sat Sep 12 00:31:43 2026 +0200
@@ -6,21 +6,16 @@
 
 from trytond.model import ModelView
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 from trytond.url import HOSTNAME, http_host
 
 from .mixin import NotMixin, ReportMixin, TestMixin, TestSecondMixin
 
 
-class UrlTestCase(TestCase):
+class UrlTestCase(DBTestCase):
     "Test URL generation"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def testModelURL(self):
@@ -75,13 +70,9 @@
                 http_host(), urllib.parse.quote(db_name)))
 
 
-class MixinTestCase(TestCase):
+class MixinTestCase(DBTestCase):
     "Test Mixin"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_mixin_on_modelview(self):
@@ -114,13 +105,9 @@
         self.assertTrue(issubclass(Report, ReportMixin))
 
 
-class DeactivableMixinTestCase(TestCase):
+class DeactivableMixinTestCase(DBTestCase):
     "Test DeactivableMixin"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_deactivable_default_active(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_model.py
--- a/trytond/trytond/tests/test_model.py       Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_model.py       Sat Sep 12 00:31:43 2026 +0200
@@ -5,18 +5,13 @@
 
 from trytond.model.model import humanize, record
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, TestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class ModelTestCase(TestCase):
+class ModelTestCase(DBTestCase):
     'Test Model'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_repr(self):
@@ -502,15 +497,15 @@
                 self.assertEqual(humanize(name), result)
 
 
-class ModelTranslationTestCase(TestCase):
+class ModelTranslationTestCase(DBTestCase):
     "Test Model translation"
+    module = 'tests'
     default_language = 'en'
     other_language = 'fr'
 
     @classmethod
     def setUpClass(cls):
         super().setUpClass()
-        activate_module('tests')
         cls.setup_language()
 
     @classmethod
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_model_log.py
--- a/trytond/trytond/tests/test_model_log.py   Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_model_log.py   Sat Sep 12 00:31:43 2026 +0200
@@ -4,16 +4,12 @@
 from trytond.pool import Pool
 from trytond.transaction import Transaction
 
-from .test_tryton import TestCase, activate_module, with_transaction
+from .test_tryton import DBTestCase, with_transaction
 
 
-class ModelLogTestCase(TestCase):
+class ModelLogTestCase(DBTestCase):
     "Test Model Log"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_log(self):
diff -r 7df15278c979 -r 6820530c40b6 
trytond/trytond/tests/test_modelsingleton.py
--- a/trytond/trytond/tests/test_modelsingleton.py      Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_modelsingleton.py      Sat Sep 12 00:31:43 
2026 +0200
@@ -5,18 +5,13 @@
 from datetime import datetime
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class ModelSingletonTestCase(TestCase):
+class ModelSingletonTestCase(DBTestCase):
     'Test ModelSingleton'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_read(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_modelsql.py
--- a/trytond/trytond/tests/test_modelsql.py    Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_modelsql.py    Sat Sep 12 00:31:43 2026 +0200
@@ -14,17 +14,13 @@
 from trytond.model.modelsql import split_subquery_domain
 from trytond.pool import Pool
 from trytond.tests.test_tryton import (
-    CONTEXT, DB_NAME, USER, TestCase, activate_module, with_transaction)
+    CONTEXT, DB_NAME, USER, DBTestCase, with_transaction)
 from trytond.transaction import Transaction, TransactionError
 
 
-class ModelSQLTestCase(TestCase):
+class ModelSQLTestCase(DBTestCase):
     'Test ModelSQL'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_read(self):
@@ -1422,14 +1418,14 @@
         self.assertEqual(stats, [("Foo", 2), ("Bar", 1)])
 
 
-class TranslationTestCase(TestCase):
+class TranslationTestCase(DBTestCase):
+    module = 'tests'
     default_language = 'fr'
     other_language = 'en'
 
     @classmethod
     def setUpClass(cls):
         super().setUpClass()
-        activate_module('tests')
         cls.setup_language()
 
     @classmethod
@@ -1455,8 +1451,8 @@
 
     @classmethod
     def tearDownClass(cls):
+        cls.restore_language()
         super().tearDownClass()
-        cls.restore_language()
 
     @classmethod
     @with_transaction()
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_modelstorage.py
--- a/trytond/trytond/tests/test_modelstorage.py        Thu Sep 03 17:23:33 
2026 +0200
+++ b/trytond/trytond/tests/test_modelstorage.py        Sat Sep 12 00:31:43 
2026 +0200
@@ -9,18 +9,13 @@
     AccessError, DomainValidationError, RequiredValidationError)
 from trytond.model.modelstorage import _UnsavedRecordError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction, check_access
 
 
-class ModelStorageTestCase(TestCase):
+class ModelStorageTestCase(DBTestCase):
     'Test ModelStorage'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_search_read_order(self):
@@ -785,13 +780,9 @@
         self.assertEqual(notification.description, "Long description")
 
 
-class BrowseListTestCase(TestCase):
+class BrowseListTestCase(DBTestCase):
     "Test BrowseList"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_contains(self):
@@ -1080,13 +1071,9 @@
         self.assertEqual(blist.ids, [1, 2, 3])
 
 
-class EvalEnvironmentTestCase(TestCase):
+class EvalEnvironmentTestCase(DBTestCase):
     "Test EvalEnvironment"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_char_field(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_modelview.py
--- a/trytond/trytond/tests/test_modelview.py   Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_modelview.py   Sat Sep 12 00:31:43 2026 +0200
@@ -11,17 +11,12 @@
 from trytond.model.modelview import set_visible
 from trytond.pool import Pool
 from trytond.pyson import Eval, PYSONDecoder, PYSONEncoder
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class ModelView(TestCase):
+class ModelView(DBTestCase):
     "Test ModelView"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def test_set_visible(self):
         "Test loading of visible x2m fields in group"
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_mptt.py
--- a/trytond/trytond/tests/test_mptt.py        Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_mptt.py        Sat Sep 12 00:31:43 2026 +0200
@@ -5,22 +5,17 @@
 from unittest.mock import patch
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import inactive_records
 
 from .test_tree import TreeTestCaseMixin
 
 
-class MPTTTestCase(TreeTestCaseMixin, TestCase):
+class MPTTTestCase(TreeTestCaseMixin, DBTestCase):
     'Test Modified Preorder Tree Traversal'
+    module = 'tests'
     model_name = 'test.mptt'
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def check_tree(self, parent_id=None, left=-1, right=sys.maxsize):
         pool = Pool()
         Mptt = pool.get(self.model_name)
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_multivalue.py
--- a/trytond/trytond/tests/test_multivalue.py  Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_multivalue.py  Sat Sep 12 00:31:43 2026 +0200
@@ -2,17 +2,12 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class MultiValueTestCase(TestCase):
+class MultiValueTestCase(DBTestCase):
     "Test MultiValue"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_get_multivalue(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_order.py
--- a/trytond/trytond/tests/test_order.py       Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_order.py       Sat Sep 12 00:31:43 2026 +0200
@@ -4,17 +4,12 @@
 
 from trytond.model import sequence_reorder, sort
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class SequenceOrderedMixinTestCase(TestCase):
+class SequenceOrderedMixinTestCase(DBTestCase):
     'Test SequenceOrderedMixin'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_order(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_path.py
--- a/trytond/trytond/tests/test_path.py        Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_path.py        Sat Sep 12 00:31:43 2026 +0200
@@ -2,14 +2,15 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import TestCase
+from trytond.tests.test_tryton import DBTestCase
 from trytond.transaction import inactive_records
 
 from .test_tree import TreeTestCaseMixin
 
 
-class PathTestCase(TreeTestCaseMixin, TestCase):
+class PathTestCase(TreeTestCaseMixin, DBTestCase):
     "Test Path"
+    module = 'tests'
     model_name = 'test.path'
 
     def check_tree(self, parent_id=None):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_report.py
--- a/trytond/trytond/tests/test_report.py      Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_report.py      Sat Sep 12 00:31:43 2026 +0200
@@ -15,19 +15,14 @@
 from trytond.model.exceptions import AccessError
 from trytond.pool import Pool
 from trytond.report.report import Report, get_email
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.tools import file_open
 from trytond.transaction import Transaction
 
 
-class ReportTestCase(TestCase):
+class ReportTestCase(DBTestCase):
     'Test Report'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_format_datetime(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_resource.py
--- a/trytond/trytond/tests/test_resource.py    Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_resource.py    Sat Sep 12 00:31:43 2026 +0200
@@ -5,18 +5,13 @@
 
 from trytond.model.exceptions import AccessError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class ResourceTestCase(TestCase):
+class ResourceTestCase(DBTestCase):
     "Test Resource"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_resources_copied(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_routing.py
--- a/trytond/trytond/tests/test_routing.py     Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_routing.py     Sat Sep 12 00:31:43 2026 +0200
@@ -9,19 +9,19 @@
 from trytond.protocols.wrappers import HTTPStatus, Response
 from trytond.routing import BuildURLError
 from trytond.tests.test_tryton import (
-    DB_NAME, Client, RouteTestCase, TestCase, activate_module, drop_db,
-    with_transaction)
+    DB_NAME, Client, DBTestCase, RouteTestCase, with_transaction)
 from trytond.transaction import Transaction
 from trytond.wsgi import app
 
 
-class RoutesTestCase(TestCase):
+class RoutesTestCase(DBTestCase):
+    module = 'ir'
+    extras = ['res']
+    language = 'fr'
 
     @classmethod
     def setUpClass(cls):
         super().setUpClass()
-        drop_db()
-        activate_module(['ir', 'res'], 'fr')
         pool = Pool(DB_NAME)
         with Transaction().start(DB_NAME, 0):
             User = pool.get('res.user')
@@ -29,11 +29,6 @@
             admin.password = 'password'
             admin.save()
 
-    @classmethod
-    def tearDownClass(cls):
-        super().tearDownClass()
-        drop_db()
-
     @property
     def auth_headers(self):
         return {
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_rpc.py
--- a/trytond/trytond/tests/test_rpc.py Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_rpc.py Sat Sep 12 00:31:43 2026 +0200
@@ -4,18 +4,13 @@
 
 from trytond.protocols.wrappers import exceptions
 from trytond.rpc import RPC
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class RPCTestCase(TestCase):
+class RPCTestCase(DBTestCase):
     "Test RPC"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('ir')
+    module = 'ir'
 
     @with_transaction()
     def test_simple(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_rule.py
--- a/trytond/trytond/tests/test_rule.py        Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_rule.py        Sat Sep 12 00:31:43 2026 +0200
@@ -5,19 +5,14 @@
 from trytond.model import ModelAccessProxy
 from trytond.model.exceptions import AccessError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 _context = {'_check_access': True}
 
 
-class ModelRuleTestCase(TestCase):
+class ModelRuleTestCase(DBTestCase):
     "Test Model Rule"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction(context=_context)
     def test_perm_create_without_rule(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_sendmail.py
--- a/trytond/trytond/tests/test_sendmail.py    Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_sendmail.py    Sat Sep 12 00:31:43 2026 +0200
@@ -8,16 +8,12 @@
     SMTPDataManager, get_smtp_server, sendmail, sendmail_transactional)
 from trytond.transaction import Transaction
 
-from .test_tryton import TestCase, activate_module, with_transaction
+from .test_tryton import DBTestCase, with_transaction
 
 
-class SendmailTestCase(TestCase):
+class SendmailTestCase(DBTestCase):
     'Test sendmail'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_sendmail_transactional(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_sequence.py
--- a/trytond/trytond/tests/test_sequence.py    Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_sequence.py    Sat Sep 12 00:31:43 2026 +0200
@@ -6,19 +6,14 @@
 from trytond.convert import import_xml
 from trytond.ir.sequence import LastTimestampError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.tools import file_open
 from trytond.transaction import Transaction
 
 
-class SequenceTestCase(TestCase):
+class SequenceTestCase(DBTestCase):
     'Test Sequence'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @staticmethod
     def get_model():
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_transaction.py
--- a/trytond/trytond/tests/test_transaction.py Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_transaction.py Sat Sep 12 00:31:43 2026 +0200
@@ -4,8 +4,7 @@
 from unittest.mock import Mock
 
 from trytond import backend
-from trytond.tests.test_tryton import (
-    CONTEXT, DB_NAME, USER, TestCase, activate_module)
+from trytond.tests.test_tryton import CONTEXT, DB_NAME, USER, DBTestCase
 from trytond.transaction import Transaction
 
 
@@ -20,13 +19,9 @@
         return True
 
 
-class TransactionTestCase(TestCase):
+class TransactionTestCase(DBTestCase):
     'Test the Transaction Context manager'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def test_nonexistdb(self):
         '''Attempt opening a transaction with a non existant DB
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_tree.py
--- a/trytond/trytond/tests/test_tree.py        Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_tree.py        Sat Sep 12 00:31:43 2026 +0200
@@ -6,18 +6,12 @@
 from trytond.model import sum_tree
 from trytond.model.exceptions import DomainValidationError, RecursionError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
 class TreeTestCaseMixin:
     model_name = None
 
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
-
     def create(self):
         pool = Pool()
         Model = pool.get(self.model_name)
@@ -173,13 +167,9 @@
         self.check_tree()
 
 
-class TreeMixinTestCase(TestCase):
+class TreeMixinTestCase(DBTestCase):
     "Test TreeMixin"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_name_domain(self):
@@ -435,13 +425,9 @@
             parent1.save()
 
 
-class TreeTestCase(TestCase):
+class TreeTestCase(DBTestCase):
     "Test Tree"
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_sum_tree(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_trigger.py
--- a/trytond/trytond/tests/test_trigger.py     Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_trigger.py     Sat Sep 12 00:31:43 2026 +0200
@@ -8,19 +8,14 @@
 from trytond.model.exceptions import DomainValidationError, SQLConstraintError
 from trytond.pool import Pool
 from trytond.pyson import Eval, PYSONEncoder
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.tests.trigger import TRIGGER_LOGS
 from trytond.transaction import Transaction
 
 
-class TriggerTestCase(TestCase):
+class TriggerTestCase(DBTestCase):
     'Test Trigger'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     def setUp(self):
         TRIGGER_LOGS.clear()
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_tryton.py
--- a/trytond/trytond/tests/test_tryton.py      Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_tryton.py      Sat Sep 12 00:31:43 2026 +0200
@@ -49,6 +49,7 @@
     'Client',
     'DB_NAME',
     'TestCase',
+    'DBTestCase',
     'ModuleTestCase',
     'RouteTestCase',
     'ExtensionTestCase',
@@ -370,7 +371,7 @@
             warnings.filterwarnings(action, message, category, module, lineno)
 
 
-class _DBTestCase(TestCase):
+class DBTestCase(TestCase):
     module = None
     extras = None
     language = 'en'
@@ -390,7 +391,7 @@
         drop_db()
 
 
-class ModuleTestCase(_DBTestCase):
+class ModuleTestCase(DBTestCase):
     "Tryton Module Test Case"
 
     @with_transaction()
@@ -1251,7 +1252,7 @@
                     self.assertTrue(callable(getattr(router, r_name, None)))
 
 
-class RouteTestCase(_DBTestCase):
+class RouteTestCase(DBTestCase):
     "Tryton Route Test Case"
 
     @classmethod
@@ -1319,7 +1320,7 @@
         pool.init()
 
 
-class ExtensionTestCase(TestCase):
+class ExtensionTestCase(DBTestCase):
     extension = None
 
     @classmethod
@@ -1329,8 +1330,8 @@
 
     @classmethod
     def tearDownClass(cls):
+        cls._deactivate_extension()
         super().tearDownClass()
-        cls._deactivate_extension()
 
     @classmethod
     @with_transaction()
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_union.py
--- a/trytond/trytond/tests/test_union.py       Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_union.py       Sat Sep 12 00:31:43 2026 +0200
@@ -2,17 +2,12 @@
 # this repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class UnionMixinTestCase(TestCase):
+class UnionMixinTestCase(DBTestCase):
     'Test UnionMixin'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+    module = 'tests'
 
     @with_transaction()
     def test_union(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_user.py
--- a/trytond/trytond/tests/test_user.py        Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_user.py        Sat Sep 12 00:31:43 2026 +0200
@@ -9,8 +9,7 @@
 from trytond.pool import Pool
 from trytond.res import user as user_module
 from trytond.res.user import PasswordError
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 FROM = '[email protected]'
@@ -26,13 +25,9 @@
         config.set('session', 'authentications', saved_methods)
 
 
-class UserTestCase(TestCase):
+class UserTestCase(DBTestCase):
     'Test User'
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('res')
+    module = 'res'
 
     def setUp(self):
         methods = config.get('session', 'authentications')
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_wizard.py
--- a/trytond/trytond/tests/test_wizard.py      Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_wizard.py      Sat Sep 12 00:31:43 2026 +0200
@@ -3,17 +3,12 @@
 
 from trytond.model.exceptions import AccessError
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 from trytond.transaction import Transaction
 
 
-class WizardTestCase(TestCase):
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+class WizardTestCase(DBTestCase):
+    module = 'tests'
 
     @with_transaction()
     def test_create(self):
diff -r 7df15278c979 -r 6820530c40b6 trytond/trytond/tests/test_workflow.py
--- a/trytond/trytond/tests/test_workflow.py    Thu Sep 03 17:23:33 2026 +0200
+++ b/trytond/trytond/tests/test_workflow.py    Sat Sep 12 00:31:43 2026 +0200
@@ -2,16 +2,11 @@
 # repository contains the full copyright notices and license terms.
 
 from trytond.pool import Pool
-from trytond.tests.test_tryton import (
-    TestCase, activate_module, with_transaction)
+from trytond.tests.test_tryton import DBTestCase, with_transaction
 
 
-class WorkflowTestCase(TestCase):
-
-    @classmethod
-    def setUpClass(cls):
-        super().setUpClass()
-        activate_module('tests')
+class WorkflowTestCase(DBTestCase):
+    module = 'tests'
 
     # TODO add test for Workflow.transition
     @with_transaction()

Reply via email to