@@ -64,7 +64,7 @@ class TransactionPydanticCase(common.TransactionCase, PydanticMixin):
6464
6565 @classmethod
6666 def setUpClass (cls ):
67- super (TransactionPydanticCase , cls ).setUpClass ()
67+ super ().setUpClass ()
6868 cls .setUpPydantic ()
6969
7070 # pylint: disable=W8106
@@ -75,30 +75,8 @@ def setUp(self):
7575 PydanticMixin .setUp (self )
7676
7777
78- class SavepointPydanticCase (common .SavepointCase , PydanticMixin ):
79- """A SavepointCase that loads all the pydantic classes
80-
81- It is used like an usual Odoo's SavepointCase, but it ensures
82- that all the pydantic classes of the current addon and its dependencies
83- are loaded.
84-
85- """
86-
87- @classmethod
88- def setUpClass (cls ):
89- super (SavepointPydanticCase , cls ).setUpClass ()
90- cls .setUpPydantic ()
91-
92- # pylint: disable=W8106
93- def setUp (self ):
94- # resolve an inheritance issue (common.SavepointCase does not call
95- # super)
96- common .SavepointCase .setUp (self )
97- PydanticMixin .setUp (self )
98-
99-
10078class PydanticRegistryCase (
101- common .TreeCase , common .MetaCase ("DummyCase" , (object ,), {})
79+ common .BaseCase , common .MetaCase ("DummyCase" , (object ,), {})
10280):
10381 """This test case can be used as a base for writings tests on pydantic classes
10482
@@ -107,10 +85,9 @@ class PydanticRegistryCase(
10785 or not, or when you want to create additional pydantic classes in your tests.
10886
10987 If you only want to *use* the pydantic classes of the tested addon in your tests,
110- then consider using one of :
88+ then consider using:
11189
11290 * :class:`TransactionPydanticCase`
113- * :class:`SavepointPydanticCase`
11491
11592 This test case creates a special
11693 :class:`odoo.addons.pydantic.registry.PydanticClassesRegistry` for the purpose of
@@ -132,7 +109,7 @@ class PydanticRegistryCase(
132109 """
133110
134111 def setUp (self ):
135- super (PydanticRegistryCase , self ).setUp ()
112+ super ().setUp ()
136113
137114 # keep the original classes registered by the annotation
138115 # so we'll restore them at the end of the tests, it avoid
@@ -182,7 +159,7 @@ def notready():
182159 odoo_pydantic_registry .reset (token )
183160
184161 def tearDown (self ):
185- super (PydanticRegistryCase , self ).tearDown ()
162+ super ().tearDown ()
186163 self .restore_registry ()
187164
188165 def _load_module_pydantics (self , module ):
@@ -212,30 +189,17 @@ def restore_registry(self):
212189
213190
214191class TransactionPydanticRegistryCase (common .TransactionCase , PydanticRegistryCase ):
215- """ Adds Odoo Transaction in the base Pydantic TestCase """
192+ """Adds Odoo Transaction in the base Pydantic TestCase"""
216193
217194 # pylint: disable=W8106
218- def setUp (self ):
195+ @classmethod
196+ def setUpClass (cls ):
219197 # resolve an inheritance issue (common.TransactionCase does not use
220198 # super)
221- common .TransactionCase .setUp (self )
222- PydanticRegistryCase .setUp (self )
223-
224- def teardown (self ):
225- common .TransactionCase .tearDown (self )
226- PydanticRegistryCase .tearDown (self )
227-
228-
229- class SavepointPydanticRegistryCase (common .SavepointCase , PydanticRegistryCase ):
230- """ Adds Odoo Transaction with Savepoint in the base Pydantic TestCase """
231-
232- # pylint: disable=W8106
233- def setUp (self ):
234- # resolve an inheritance issue (common.SavepointCase does not use
235- # super)
236- common .SavepointCase .setUp (self )
237- PydanticRegistryCase .setUp (self )
199+ common .TransactionCase .setUpClass (cls )
200+ PydanticRegistryCase .setUp (cls )
238201
239- def teardown (self ):
240- common .SavepointCase .tearDown (self )
241- PydanticRegistryCase .tearDown (self )
202+ @classmethod
203+ def tearDownClass (cls ):
204+ common .TransactionCase .tearDownClass (cls )
205+ PydanticRegistryCase .tearDown (cls )
0 commit comments