Add TestCase to filter warnings with TEST_PYTHONWARNINGS

This commit is contained in:
Cédric Krier
2024-06-09 12:45:39 +02:00
parent 685411cf9a
commit 36f3adca1e
68 changed files with 298 additions and 216 deletions
+3 -3
View File
@@ -2,14 +2,14 @@
# this repository contains the full copyright notices and license terms.
import datetime
import unittest
from decimal import ROUND_HALF_DOWN, Decimal
from trytond import backend
from trytond.modules.currency.ecb import (
RatesNotAvailableError, UnsupportedCurrencyError, get_rates)
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.tests.test_tryton import (
ModuleTestCase, TestCase, with_transaction)
from trytond.transaction import Transaction
@@ -394,7 +394,7 @@ class CurrencyTestCase(ModuleTestCase):
self.assertSetEqual(data, result)
class ECBtestCase(unittest.TestCase):
class ECBtestCase(TestCase):
def test_rate_EUR_week_ago(self):
"Fetch EUR rates a week ago"
+3 -3
View File
@@ -1,14 +1,14 @@
# This file is part of trytond_gis. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import unittest
from sql import Null
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class TestGeographicFields(unittest.TestCase):
class TestGeographicFields(TestCase):
@classmethod
def setUpClass(cls):
+12 -2
View File
@@ -38,12 +38,22 @@ Tests
dump and restore operations.
The default value is the number of CPU.
TestCase
--------
.. class:: TestCase()
A subclass of `unittest.TestCase`_ for testing non-module Tryton.
It setups warning filters based on ``TEST_PYTHONWARNINGS`` environment
variable.
ModuleTestCase
--------------
.. class:: ModuleTestCase()
A subclass of `unittest.TestCase`_ that tests a Tryton module.
A subclass of :class:`TestCase` that tests a Tryton module.
Some tests are included to ensure that the module works properly.
It creates a temporary database with the module activated in setUpClass_ and
@@ -67,7 +77,7 @@ RouteTestCase
.. class:: RouteTestCase()
A subclass of `unittest.TestCase`_ to test Tryton routes.
A subclass of :class:`TestCase` to test Tryton routes.
It creates a temporary database with the module activated in setUpClass_ and
drops it in the tearDownClass_ method.
+5 -5
View File
@@ -1,17 +1,17 @@
# -*- coding: utf-8 -*-
# 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
from trytond.model.exceptions import AccessError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
_context = {'_check_access': True}
class _ModelAccessTestCase(unittest.TestCase):
class _ModelAccessTestCase(TestCase):
_perm = None
@classmethod
@@ -408,7 +408,7 @@ class ModelAccessModelTestCase(_ModelAccessTestCase):
TestAccess.search([])
class _ModelFieldAccessTestCase(unittest.TestCase):
class _ModelFieldAccessTestCase(TestCase):
_perm = None
@classmethod
@@ -1020,7 +1020,7 @@ class ModelFieldAccessWriteTestCase(_ModelFieldAccessTestCase):
TestAccess.write([record], {'field2': 'test'})
class MenuActionAccessReadTestCase(unittest.TestCase):
class MenuActionAccessReadTestCase(TestCase):
@classmethod
def setUpClass(cls):
+3 -3
View File
@@ -2,17 +2,17 @@
# this repository contains the full copyright notices and license terms.
import datetime as dt
import math
import unittest
from sql import Literal, Select, functions
from sql.functions import CurrentTimestamp, DateTrunc, ToChar
from trytond.model import fields
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class BackendTestCase(unittest.TestCase):
class BackendTestCase(TestCase):
"Test the backend"
@classmethod
+3 -3
View File
@@ -8,11 +8,11 @@ from unittest.mock import patch
from trytond import backend, bus
from trytond.bus import Bus, _MessageQueue, notify
from trytond.tests.test_tryton import (
DB_NAME, activate_module, with_transaction)
DB_NAME, TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class MessageQueueTestCase(unittest.TestCase):
class MessageQueueTestCase(TestCase):
def setUp(self):
self._timestamp = 0
@@ -74,7 +74,7 @@ class MessageQueueTestCase(unittest.TestCase):
self.assertEqual(content, {'message_id': 10})
class BusTestCase(unittest.TestCase):
class BusTestCase(TestCase):
"Test Bus"
@classmethod
+5 -5
View File
@@ -12,7 +12,7 @@ from trytond import cache as cache_mod
from trytond.cache import (
LRUDict, LRUDictTransaction, MemoryCache, freeze, unfreeze)
from trytond.tests.test_tryton import (
DB_NAME, USER, activate_module, with_transaction)
DB_NAME, USER, TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
cache = MemoryCache('test.cache')
@@ -22,7 +22,7 @@ cache_ignored_local_context = MemoryCache(
cache_ignored_global_context = MemoryCache('test.cache.ignored.global')
class CacheTestCase(unittest.TestCase):
class CacheTestCase(TestCase):
"Test Cache"
@classmethod
@@ -96,7 +96,7 @@ class CacheTestCase(unittest.TestCase):
self.assertEqual(value, 1)
class MemoryCacheTestCase(unittest.TestCase):
class MemoryCacheTestCase(TestCase):
"Test Cache"
@classmethod
@@ -266,7 +266,7 @@ class MemoryCacheChannelTestCase(MemoryCacheTestCase):
super().test_memory_cache_sync()
class LRUDictTestCase(unittest.TestCase):
class LRUDictTestCase(TestCase):
"Test LRUDict"
def test_setitem(self):
@@ -315,7 +315,7 @@ class LRUDictTestCase(unittest.TestCase):
self.assertEqual(lru_dict['foo'], 'foo')
class LRUDictTransactionTestCase(unittest.TestCase):
class LRUDictTransactionTestCase(TestCase):
"Test LRUDictTransaction"
@classmethod
+4 -3
View File
@@ -1,19 +1,20 @@
# -*- coding: utf-8 -*-
# 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
from unittest.mock import patch
from trytond.model import fields
from trytond.model.exceptions import AccessError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
from .test_modelsql import TranslationTestCase
class CopyTestCase(unittest.TestCase):
class CopyTestCase(TestCase):
'Test copy'
@classmethod
+3 -3
View File
@@ -2,15 +2,15 @@
# 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 datetime
import unittest
from decimal import Decimal
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class ExportDataTestCase(unittest.TestCase):
class ExportDataTestCase(TestCase):
'Test export_data'
@classmethod
+3 -3
View File
@@ -2,7 +2,6 @@
# this repository contains the full copyright notices and license terms.
import shutil
import tempfile
import unittest
from sql import Literal
@@ -10,13 +9,14 @@ from trytond.config import config
from trytond.model import fields
from trytond.model.exceptions import RequiredValidationError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
cast = fields.Binary.cast
class FieldBinaryTestCase(unittest.TestCase):
class FieldBinaryTestCase(TestCase):
"Test Field Binary"
@classmethod
+3 -3
View File
@@ -1,14 +1,14 @@
# 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
from sql import Literal
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldBooleanTestCase(unittest.TestCase):
class FieldBooleanTestCase(TestCase):
"Test Field Boolean"
@classmethod
+3 -3
View File
@@ -10,7 +10,7 @@ from trytond.model.exceptions import (
ForbiddenCharValidationError, RequiredValidationError, SizeValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import (
ExtensionTestCase, activate_module, with_transaction)
ExtensionTestCase, TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
@@ -382,7 +382,7 @@ class CommonTestCaseMixin:
self.assertEqual(char.char_unstripped, " Foo ")
class FieldCharTestCase(unittest.TestCase, CommonTestCaseMixin):
class FieldCharTestCase(TestCase, CommonTestCaseMixin):
"Test Field Char"
@classmethod
@@ -608,7 +608,7 @@ class FieldCharTestCase(unittest.TestCase, CommonTestCaseMixin):
self.assertEqual(read_record.char_unstripped, " Bar ")
class FieldCharTranslatedTestCase(unittest.TestCase, CommonTestCaseMixin):
class FieldCharTranslatedTestCase(TestCase, CommonTestCaseMixin):
"Test Field Char Translated"
@classmethod
+3 -4
View File
@@ -1,13 +1,12 @@
# 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
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldContextTestCase(unittest.TestCase):
class FieldContextTestCase(TestCase):
"Test context on field"
@classmethod
+3 -2
View File
@@ -9,7 +9,8 @@ from sql.functions import CurrentDate
from trytond import backend
from trytond.model.exceptions import RequiredValidationError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
today = datetime.date(2009, 1, 1)
@@ -18,7 +19,7 @@ yesterday = today - datetime.timedelta(1)
default_date = datetime.date(2000, 1, 1)
class FieldDateTestCase(unittest.TestCase):
class FieldDateTestCase(TestCase):
"Test Field Date"
@classmethod
+3 -3
View File
@@ -1,14 +1,14 @@
# 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 datetime
import unittest
from sql.functions import CurrentTimestamp
from trytond.model.exceptions import (
RequiredValidationError, TimeFormatValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
today = datetime.datetime(2009, 1, 1, 12, 0, 0)
tomorrow = today + datetime.timedelta(1)
@@ -16,7 +16,7 @@ yesterday = today - datetime.timedelta(1)
default_datetime = datetime.datetime(2000, 1, 1, 12, 0, 0)
class FieldDateTimeTestCase(unittest.TestCase):
class FieldDateTimeTestCase(TestCase):
"Test Field DateTime"
@classmethod
+3 -3
View File
@@ -1,13 +1,13 @@
# 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
from trytond.model import ModelView, fields
from trytond.pyson import Eval, If
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldDependsTestCase(unittest.TestCase):
class FieldDependsTestCase(TestCase):
'Test Field Depends'
@classmethod
+2 -2
View File
@@ -7,10 +7,10 @@ from trytond.model.dictschema import SelectionError
from trytond.model.exceptions import RequiredValidationError
from trytond.pool import Pool
from trytond.tests.test_tryton import (
ExtensionTestCase, activate_module, with_transaction)
ExtensionTestCase, TestCase, activate_module, with_transaction)
class FieldDictTestCase(unittest.TestCase):
class FieldDictTestCase(TestCase):
"Test Field Dict"
@classmethod
+3 -3
View File
@@ -1,16 +1,16 @@
# 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
from sql import Literal
from trytond.model.exceptions import (
DigitsValidationError, RequiredValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldFloatTestCase(unittest.TestCase):
class FieldFloatTestCase(TestCase):
"Test Field Float"
@classmethod
+4 -3
View File
@@ -1,14 +1,15 @@
# 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
from unittest.mock import patch
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class FieldFunctionTestCase(unittest.TestCase):
class FieldFunctionTestCase(TestCase):
"Test Field Function"
@classmethod
+3 -3
View File
@@ -1,16 +1,16 @@
# 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
from sql import Literal
from trytond.model.exceptions import (
DomainValidationError, RequiredValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldIntegerTestCase(unittest.TestCase):
class FieldIntegerTestCase(TestCase):
"Test Field Integer"
@classmethod
@@ -1,11 +1,11 @@
# 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
from trytond.model.exceptions import (
DomainValidationError, RequiredValidationError, SizeValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class CommonTestCaseMixin:
@@ -374,7 +374,7 @@ class CommonTestCaseMixin:
self.assertIsNone(relation.write_date)
class FieldMany2ManyTestCase(unittest.TestCase, CommonTestCaseMixin):
class FieldMany2ManyTestCase(TestCase, CommonTestCaseMixin):
"Test Field Many2Many"
@classmethod
@@ -780,7 +780,7 @@ class FieldMany2ManyTestCase(unittest.TestCase, CommonTestCaseMixin):
sorted([t.id for t in targets], reverse=True))
class FieldMany2ManyReferenceTestCase(unittest.TestCase, CommonTestCaseMixin):
class FieldMany2ManyReferenceTestCase(TestCase, CommonTestCaseMixin):
"Test Field Many2Many Reference"
@classmethod
+4 -4
View File
@@ -1,15 +1,15 @@
# 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
from sql import Join
from trytond.model.exceptions import DomainValidationError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldMany2OneTestCase(unittest.TestCase):
class FieldMany2OneTestCase(TestCase):
"Test Field Many2One"
@classmethod
@@ -243,7 +243,7 @@ class FieldMany2OneTestCase(unittest.TestCase):
self.assertEqual(record.target.context, 'foo')
class FieldMany2OneTreeTestCase(unittest.TestCase):
class FieldMany2OneTreeTestCase(TestCase):
"Test Field Many2One Tree"
model_name = 'test.many2one_tree'
@@ -6,11 +6,12 @@ from trytond import backend
from trytond.model.exceptions import (
RequiredValidationError, SelectionValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class FieldMultiSelectionTestCase(unittest.TestCase):
class FieldMultiSelectionTestCase(TestCase):
"Test Field MultiSelection"
@classmethod
+4 -3
View File
@@ -1,6 +1,6 @@
# 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
from decimal import Decimal, InvalidOperation
from sql import Literal
@@ -8,10 +8,11 @@ from sql import Literal
from trytond.model.exceptions import (
DigitsValidationError, RequiredValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldNumericTestCase(unittest.TestCase):
class FieldNumericTestCase(TestCase):
"Test Field Numeric"
@classmethod
+6 -6
View File
@@ -1,12 +1,12 @@
# 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
from trytond.config import config
from trytond.model.exceptions import (
DomainValidationError, RequiredValidationError, SizeValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class SearchTestCaseMixin:
@@ -450,7 +450,7 @@ class CommonTestCaseMixin:
class FieldOne2ManyTestCase(
unittest.TestCase, CommonTestCaseMixin, SearchTestCaseMixin):
TestCase, CommonTestCaseMixin, SearchTestCaseMixin):
"Test Field One2Many"
_strategy = 'IN'
@@ -719,7 +719,7 @@ class FieldOne2ManyTestCase(
class FieldOne2ManyReferenceTestCase(
unittest.TestCase, CommonTestCaseMixin, SearchTestCaseMixin):
TestCase, CommonTestCaseMixin, SearchTestCaseMixin):
"Test Field One2Many Reference"
_strategy = 'IN'
@@ -734,7 +734,7 @@ class FieldOne2ManyReferenceTestCase(
return Pool().get('test.one2many_reference.target')
class FieldOne2ManyExistsTestCase(unittest.TestCase, SearchTestCaseMixin):
class FieldOne2ManyExistsTestCase(TestCase, SearchTestCaseMixin):
"Test Field One2Many when using EXISTS"
_strategy = 'EXISTS'
@@ -758,7 +758,7 @@ class FieldOne2ManyExistsTestCase(unittest.TestCase, SearchTestCaseMixin):
class FieldOne2ManyReferenceExistsTestCase(
unittest.TestCase, SearchTestCaseMixin):
TestCase, SearchTestCaseMixin):
"Test Field One2Many Reference when using EXISTS"
_strategy = 'EXISTS'
+3 -3
View File
@@ -1,14 +1,14 @@
# 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
from trytond.model.exceptions import (
DomainValidationError, RequiredValidationError, SQLConstraintError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldOne2OneTestCase(unittest.TestCase):
class FieldOne2OneTestCase(TestCase):
"Test Field One2One"
@classmethod
@@ -1,14 +1,14 @@
# 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
from trytond.model.exceptions import (
DomainValidationError, RequiredValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldReferenceTestCase(unittest.TestCase):
class FieldReferenceTestCase(TestCase):
"Test Field Reference"
@classmethod
@@ -1,14 +1,14 @@
# 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
from trytond.model.exceptions import (
RequiredValidationError, SelectionValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class FieldSelectionTestCase(unittest.TestCase):
class FieldSelectionTestCase(TestCase):
"Test Field Selection"
@classmethod
+5 -4
View File
@@ -7,7 +7,8 @@ from trytond import backend
from trytond.model.exceptions import (
RequiredValidationError, SizeValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
@@ -389,7 +390,7 @@ class CommonTestCaseMixin:
self.assertEqual(text.text, "é")
class FieldTextTestCase(unittest.TestCase, CommonTestCaseMixin):
class FieldTextTestCase(TestCase, CommonTestCaseMixin):
"Test Field Text"
@classmethod
@@ -510,14 +511,14 @@ class FieldTextTestCase(unittest.TestCase, CommonTestCaseMixin):
})
class FieldTextTranslatedTestCase(unittest.TestCase, CommonTestCaseMixin):
class FieldTextTranslatedTestCase(TestCase, CommonTestCaseMixin):
"Test Field Text Translated"
def Text(self):
return Pool().get('test.text_translate')
class FieldFullTextTestCase(unittest.TestCase):
class FieldFullTextTestCase(TestCase):
"Test Field FullText"
@classmethod
+3 -3
View File
@@ -1,14 +1,14 @@
# 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 datetime
import unittest
from sql.functions import CurrentTimestamp
from trytond.model.exceptions import (
RequiredValidationError, TimeFormatValidationError)
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
pre_evening = datetime.time(16, 30)
evening = datetime.time(18, 45, 3)
@@ -16,7 +16,7 @@ night = datetime.time(20, 00)
default_time = datetime.time(16, 30)
class FieldTimeTestCase(unittest.TestCase):
class FieldTimeTestCase(TestCase):
"Test Field Time"
@classmethod
@@ -1,11 +1,11 @@
# 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 datetime
import unittest
from trytond.model.exceptions import RequiredValidationError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
minute = datetime.timedelta(minutes=1)
hour = datetime.timedelta(hours=1)
@@ -13,7 +13,7 @@ day = datetime.timedelta(days=1)
default_timedelta = datetime.timedelta(seconds=3600)
class FieldTimeDeltaTestCase(unittest.TestCase):
class FieldTimeDeltaTestCase(TestCase):
"Test Field TimeDelta"
@classmethod
+2 -2
View File
@@ -3,14 +3,14 @@
import os
import shutil
import tempfile
import unittest
from unittest.mock import patch
from trytond.config import config
from trytond.filestore import filestore
from trytond.tests.test_tryton import TestCase
class FileStoreTestCase(unittest.TestCase):
class FileStoreTestCase(TestCase):
"Test FileStore"
def setUp(self):
+3 -2
View File
@@ -7,11 +7,12 @@ from unittest.mock import patch
from trytond import backend
from trytond.model.exceptions import AccessError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class HistoryTestCase(unittest.TestCase):
class HistoryTestCase(TestCase):
'Test History'
@classmethod
+4 -3
View File
@@ -1,15 +1,16 @@
# 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
from unittest.mock import patch
from trytond.i18n import gettext, lazy_gettext
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.tools.string_ import LazyString
class I18nTestCase(unittest.TestCase):
class I18nTestCase(TestCase):
'Test Model Access'
@classmethod
+3 -3
View File
@@ -2,16 +2,16 @@
# 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 datetime as dt
import unittest
from decimal import Decimal
from trytond.model.exceptions import ImportDataError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class ImportDataTestCase(unittest.TestCase):
class ImportDataTestCase(TestCase):
'Test import_data'
@classmethod
+2 -2
View File
@@ -25,7 +25,7 @@ from trytond.tools import timezone
from trytond.transaction import Transaction
from .test_tryton import (
ModuleTestCase, activate_module, drop_db, with_transaction)
ModuleTestCase, TestCase, activate_module, drop_db, with_transaction)
class IrTestCase(ModuleTestCase):
@@ -478,7 +478,7 @@ class IrTestCase(ModuleTestCase):
})
class IrCronTestCase(unittest.TestCase):
class IrCronTestCase(TestCase):
"Test ir.cron features"
@classmethod
+5 -5
View File
@@ -2,19 +2,19 @@
# 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 urllib.parse
from trytond.model import ModelView
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
from trytond.url import HOSTNAME, http_host
from .mixin import NotMixin, ReportMixin, TestMixin, TestSecondMixin
class UrlTestCase(unittest.TestCase):
class UrlTestCase(TestCase):
"Test URL generation"
@classmethod
@@ -74,7 +74,7 @@ class UrlTestCase(unittest.TestCase):
http_host(), urllib.parse.quote(db_name)))
class MixinTestCase(unittest.TestCase):
class MixinTestCase(TestCase):
"Test Mixin"
@classmethod
@@ -112,7 +112,7 @@ class MixinTestCase(unittest.TestCase):
self.assertTrue(issubclass(Report, ReportMixin))
class DeactivableMixinTestCase(unittest.TestCase):
class DeactivableMixinTestCase(TestCase):
"Test DeactivableMixin"
@classmethod
+6 -5
View File
@@ -1,15 +1,16 @@
# 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
from copy import copy
from trytond.model.model import record
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class ModelTestCase(unittest.TestCase):
class ModelTestCase(TestCase):
'Test Model'
@classmethod
@@ -390,7 +391,7 @@ class ModelTestCase(unittest.TestCase):
})
class ModelTranslationTestCase(unittest.TestCase):
class ModelTranslationTestCase(TestCase):
"Test Model translation"
default_language = 'en'
other_language = 'fr'
@@ -445,7 +446,7 @@ class ModelTranslationTestCase(unittest.TestCase):
self.assertEqual(other['string'], "Nom")
class RecordTestCase(unittest.TestCase):
class RecordTestCase(TestCase):
"Test record"
def test_creation(self):
+2 -3
View File
@@ -1,14 +1,13 @@
# 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
from sql import Table
from trytond.model import Index
from trytond.tests.test_tryton import TestCase
class ModelIndexTestCase(unittest.TestCase):
class ModelIndexTestCase(TestCase):
"Test Model Index"
def test_index_equality(self):
+2 -4
View File
@@ -1,15 +1,13 @@
# 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
from trytond.pool import Pool
from trytond.transaction import Transaction
from .test_tryton import activate_module, with_transaction
from .test_tryton import TestCase, activate_module, with_transaction
class ModelLogTestCase(unittest.TestCase):
class ModelLogTestCase(TestCase):
"Test Model Log"
@classmethod
+2 -3
View File
@@ -1,9 +1,8 @@
# 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
from trytond.model import MatchMixin, fields
from trytond.tests.test_tryton import TestCase
class Model(MatchMixin):
@@ -26,7 +25,7 @@ class Target():
return f"Target({self.id})"
class ModelMatchMixinTestCase(unittest.TestCase):
class ModelMatchMixinTestCase(TestCase):
"Test MatchMixin"
def test_match(self):
+4 -3
View File
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
# 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
from datetime import datetime
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class ModelSingletonTestCase(unittest.TestCase):
class ModelSingletonTestCase(TestCase):
'Test ModelSingleton'
@classmethod
+3 -3
View File
@@ -14,11 +14,11 @@ from trytond.model.exceptions import (
from trytond.model.modelsql import split_subquery_domain
from trytond.pool import Pool
from trytond.tests.test_tryton import (
CONTEXT, DB_NAME, USER, activate_module, with_transaction)
CONTEXT, DB_NAME, USER, TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction, TransactionError
class ModelSQLTestCase(unittest.TestCase):
class ModelSQLTestCase(TestCase):
'Test ModelSQL'
@classmethod
@@ -1335,7 +1335,7 @@ class ModelSQLTestCase(unittest.TestCase):
])
class TranslationTestCase(unittest.TestCase):
class TranslationTestCase(TestCase):
default_language = 'fr'
other_language = 'en'
+4 -4
View File
@@ -1,7 +1,6 @@
# 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 warnings
from trytond.model import EvalEnvironment
@@ -9,11 +8,12 @@ from trytond.model.exceptions import (
AccessError, DomainValidationError, RequiredValidationError)
from trytond.model.modelstorage import _UnsavedRecordError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction, check_access
class ModelStorageTestCase(unittest.TestCase):
class ModelStorageTestCase(TestCase):
'Test ModelStorage'
@classmethod
@@ -766,7 +766,7 @@ class ModelStorageTestCase(unittest.TestCase):
Model.delete([record])
class EvalEnvironmentTestCase(unittest.TestCase):
class EvalEnvironmentTestCase(TestCase):
"Test EvalEnvironment"
@classmethod
+3 -2
View File
@@ -11,10 +11,11 @@ from trytond.model.exceptions import (
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 activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class ModelView(unittest.TestCase):
class ModelView(TestCase):
"Test ModelView"
@classmethod
+3 -3
View File
@@ -2,17 +2,17 @@
# 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 sys
import unittest
from unittest.mock import patch
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import inactive_records
from .test_tree import TreeTestCaseMixin
class MPTTTestCase(TreeTestCaseMixin, unittest.TestCase):
class MPTTTestCase(TreeTestCaseMixin, TestCase):
'Test Modified Preorder Tree Traversal'
model_name = 'test.mptt'
+3 -3
View File
@@ -1,12 +1,12 @@
# 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
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class MultiValueTestCase(unittest.TestCase):
class MultiValueTestCase(TestCase):
"Test MultiValue"
@classmethod
+3 -3
View File
@@ -1,14 +1,14 @@
# 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
from unittest.mock import Mock
from trytond.model import sort
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class SequenceOrderedMixinTestCase(unittest.TestCase):
class SequenceOrderedMixinTestCase(TestCase):
'Test SequenceOrderedMixin'
@classmethod
+2 -2
View File
@@ -1,14 +1,14 @@
# 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
from trytond.pool import Pool
from trytond.tests.test_tryton import TestCase
from trytond.transaction import inactive_records
from .test_tree import TreeTestCaseMixin
class PathTestCase(TreeTestCaseMixin, unittest.TestCase):
class PathTestCase(TreeTestCaseMixin, TestCase):
"Test Path"
model_name = 'test.path'
+3 -3
View File
@@ -3,11 +3,11 @@
import datetime
import json
import unittest
from decimal import Decimal
from trytond.protocols.jsonrpc import JSONDecoder, JSONEncoder, JSONRequest
from trytond.protocols.xmlrpc import XMLRequest, client
from trytond.tests.test_tryton import TestCase
from trytond.tools.immutabledict import ImmutableDict
@@ -54,7 +54,7 @@ class DumpsLoadsMixin:
self.dumps_loads(None)
class JSONTestCase(DumpsLoadsMixin, unittest.TestCase):
class JSONTestCase(DumpsLoadsMixin, TestCase):
'Test JSON'
def test_json_request(self):
@@ -73,7 +73,7 @@ class JSONTestCase(DumpsLoadsMixin, unittest.TestCase):
object_hook=JSONDecoder()), value)
class XMLTestCase(DumpsLoadsMixin, unittest.TestCase):
class XMLTestCase(DumpsLoadsMixin, TestCase):
'Test XML'
def test_xml_request(self):
+2 -1
View File
@@ -8,9 +8,10 @@ import unittest
from decimal import Decimal
from trytond import pyson
from trytond.tests.test_tryton import TestCase
class PYSONTestCase(unittest.TestCase):
class PYSONTestCase(TestCase):
'Test PySON'
def test_Decimal(self):
+3 -3
View File
@@ -1,13 +1,13 @@
# 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 datetime
import unittest
from trytond.report.report import Report
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class ReportTestCase(unittest.TestCase):
class ReportTestCase(TestCase):
'Test Report'
@classmethod
+3 -3
View File
@@ -1,13 +1,13 @@
# 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
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class ResourceTestCase(unittest.TestCase):
class ResourceTestCase(TestCase):
"Test Resource"
@classmethod
+3 -3
View File
@@ -3,16 +3,16 @@
import base64
import json
import unittest
from trytond.pool import Pool
from trytond.protocols.wrappers import Response
from trytond.tests.test_tryton import DB_NAME, Client, activate_module, drop_db
from trytond.tests.test_tryton import (
DB_NAME, Client, TestCase, activate_module, drop_db)
from trytond.transaction import Transaction
from trytond.wsgi import app
class RoutesTestCase(unittest.TestCase):
class RoutesTestCase(TestCase):
@classmethod
def setUpClass(cls):
+3 -3
View File
@@ -1,14 +1,14 @@
# 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
from unittest.mock import DEFAULT, Mock, call
from trytond.rpc import RPC
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class RPCTestCase(unittest.TestCase):
class RPCTestCase(TestCase):
"Test RPC"
@classmethod
+3 -3
View File
@@ -1,16 +1,16 @@
# 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 json
import unittest
from trytond.model.exceptions import AccessError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
_context = {'_check_access': True}
class ModelRuleTestCase(unittest.TestCase):
class ModelRuleTestCase(TestCase):
"Test Model Rule"
@classmethod
+2 -3
View File
@@ -1,7 +1,6 @@
# 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 smtplib
import unittest
from email.message import Message
from unittest.mock import ANY, MagicMock, Mock, call, patch
@@ -9,10 +8,10 @@ from trytond.sendmail import (
SMTPDataManager, get_smtp_server, sendmail, sendmail_transactional)
from trytond.transaction import Transaction
from .test_tryton import activate_module, with_transaction
from .test_tryton import TestCase, activate_module, with_transaction
class SendmailTestCase(unittest.TestCase):
class SendmailTestCase(TestCase):
'Test sendmail'
@classmethod
+3 -3
View File
@@ -2,15 +2,15 @@
# 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 datetime
import unittest
from trytond.ir.sequence import LastTimestampError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class SequenceTestCase(unittest.TestCase):
class SequenceTestCase(TestCase):
'Test Sequence'
@classmethod
+10 -9
View File
@@ -19,6 +19,7 @@ except ImportError:
email_validator = None
from trytond.pool import Pool
from trytond.tests.test_tryton import TestCase
from trytond.tools import (
cached_property, decimal_, email_, escape_wildcard, file_open, firstline,
grouped_slice, is_full_text, is_instance_method, likify, lstrip_wildcard,
@@ -43,7 +44,7 @@ except ImportError:
qrcode = None
class ToolsTestCase(unittest.TestCase):
class ToolsTestCase(TestCase):
'Test tools'
table = sql.Table('test')
@@ -433,7 +434,7 @@ class ToolsTestCase(unittest.TestCase):
long_form)
class StringPartitionedTestCase(unittest.TestCase):
class StringPartitionedTestCase(TestCase):
"Test StringPartitioned"
def test_init(self):
@@ -485,7 +486,7 @@ class StringPartitionedTestCase(unittest.TestCase):
self.assertEqual(list(s), ['bar', 'foo'])
class LazyStringTestCase(unittest.TestCase):
class LazyStringTestCase(TestCase):
"Test LazyString"
def test_init(self):
@@ -515,7 +516,7 @@ class LazyStringTestCase(unittest.TestCase):
self.assertEqual(s, 'barfoo')
class ImmutableDictTestCase(unittest.TestCase):
class ImmutableDictTestCase(TestCase):
"Test ImmutableDict"
def test_setitem(self):
@@ -575,7 +576,7 @@ class ImmutableDictTestCase(unittest.TestCase):
d.update({'foo': 'bar'})
class DomainInversionTestCase(unittest.TestCase):
class DomainInversionTestCase(TestCase):
"Test domain_inversion"
def test_simple_inversion(self):
@@ -1212,7 +1213,7 @@ class DomainInversionTestCase(unittest.TestCase):
@unittest.skipUnless(barcode, "required barcode")
class BarcodeTestCase(unittest.TestCase):
class BarcodeTestCase(TestCase):
"Test barcode module"
def test_generate_svg(self):
@@ -1229,7 +1230,7 @@ class BarcodeTestCase(unittest.TestCase):
@unittest.skipUnless(qrcode, "required qrcode")
class QRCodeTestCase(unittest.TestCase):
class QRCodeTestCase(TestCase):
"Test qrcode module"
def test_generate_svg(self):
@@ -1268,7 +1269,7 @@ class CachedPropertySlots:
cached_count = cached_property(get_count)
class CachedPropertyTestCase(unittest.TestCase):
class CachedPropertyTestCase(TestCase):
"Test cached_property"
def test_cached_property_clear(self):
@@ -1297,7 +1298,7 @@ class CachedPropertyTestCase(unittest.TestCase):
self.assertEqual(item.cached_count, 2)
class EmailTestCase(unittest.TestCase):
class EmailTestCase(TestCase):
"Test email"
def test_set_from_header_same(self):
+3 -2
View File
@@ -4,7 +4,8 @@ import unittest
from unittest.mock import Mock
from trytond import backend
from trytond.tests.test_tryton import CONTEXT, DB_NAME, USER, activate_module
from trytond.tests.test_tryton import (
CONTEXT, DB_NAME, USER, TestCase, activate_module)
from trytond.transaction import Transaction
@@ -19,7 +20,7 @@ def empty_transaction(*args, **kwargs):
return True
class TransactionTestCase(unittest.TestCase):
class TransactionTestCase(TestCase):
'Test the Transaction Context manager'
@classmethod
+4 -4
View File
@@ -1,13 +1,13 @@
# 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
from collections import defaultdict
from trytond.model import sum_tree
from trytond.model.exceptions import DomainValidationError, RecursionError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class TreeTestCaseMixin:
@@ -172,7 +172,7 @@ class TreeTestCaseMixin:
self.check_tree()
class TreeMixinTestCase(unittest.TestCase):
class TreeMixinTestCase(TestCase):
"Test TreeMixin"
@classmethod
@@ -433,7 +433,7 @@ class TreeMixinTestCase(unittest.TestCase):
parent1.save()
class TreeTestCase(unittest.TestCase):
class TreeTestCase(TestCase):
"Test Tree"
@with_transaction()
+3 -3
View File
@@ -2,19 +2,19 @@
# 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 datetime
import unittest
from itertools import combinations
from trytond.ir.exceptions import TriggerConditionError
from trytond.model.exceptions import SQLConstraintError
from trytond.pool import Pool
from trytond.pyson import Eval, PYSONEncoder
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.tests.trigger import TRIGGER_LOGS
from trytond.transaction import Transaction
class TriggerTestCase(unittest.TestCase):
class TriggerTestCase(TestCase):
'Test Trigger'
@classmethod
+68 -2
View File
@@ -16,6 +16,7 @@ import sys
import time
import unittest
import unittest.mock
import warnings
from configparser import ConfigParser
from fnmatch import fnmatchcase
from functools import reduce, wraps
@@ -43,8 +44,10 @@ __all__ = [
'CONTEXT',
'Client',
'DB_NAME',
'TestCase',
'ModuleTestCase',
'RouteTestCase',
'ExtensionTestCase',
'USER',
'activate_module',
'doctest_checker',
@@ -282,7 +285,70 @@ def with_transaction(user=1, context=None):
return decorator
class _DBTestCase(unittest.TestCase):
class TestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
if pythonwarnings := os.getenv('TEST_PYTHONWARNINGS'):
cm = warnings.catch_warnings()
cm.__enter__()
cls.addClassCleanup(cm.__exit__, cm, None, None, None)
cls.setUpClassWarning(pythonwarnings.split(','))
@classmethod
def setUpClassWarning(cls, options):
def _getcategory(category):
if not category:
return Warning
if '.' not in category:
import builtins as m
klass = category
else:
module, _, klass = category.rpartition('.')
try:
m = __import__(module, None, None, [klass])
except ImportError:
raise ValueError(
"invalid module name: %r" % module) from None
try:
cat = getattr(m, klass)
except AttributeError:
raise ValueError(
"unknown warning category: %r" % category) from None
if not issubclass(cat, Warning):
raise ValueError("invalid warning category: %r" % category)
return cat
for option in options:
parts = option.split(':')
if len(parts) > 5:
raise ValueError("too many fields (max 5): %r" % option)
while len(parts) < 5:
parts.append('')
action, message, category, module, lineno = [
s.strip() for s in parts]
if not action:
action = 'default'
category = _getcategory(category)
if message:
message = re.escape(message)
if module:
module = re.escape(module) + r'\Z'
if lineno:
try:
lineno = int(lineno)
if lineno < 0:
raise ValueError
except (ValueError, OverflowError):
raise ValueError("invalid lineno %r" % lineno) from None
else:
lineno = 0
warnings.filterwarnings(action, message, category, module, lineno)
class _DBTestCase(TestCase):
module = None
extras = None
language = 'en'
@@ -1036,7 +1102,7 @@ def create_db(name=DB_NAME, lang='en'):
pool.init()
class ExtensionTestCase(unittest.TestCase):
class ExtensionTestCase(TestCase):
extension = None
@classmethod
+3 -3
View File
@@ -1,12 +1,12 @@
# 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
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class UnionMixinTestCase(unittest.TestCase):
class UnionMixinTestCase(TestCase):
'Test UnionMixin'
@classmethod
+3 -3
View File
@@ -2,7 +2,6 @@
# repository contains the full copyright notices and license terms.
import datetime
import os
import unittest
from contextlib import contextmanager
from unittest.mock import Mock, patch
@@ -10,7 +9,8 @@ from trytond.config import config
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 activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
FROM = 'tryton@example.com'
@@ -26,7 +26,7 @@ def set_authentications(methods):
config.set('session', 'authentications', saved_methods)
class UserTestCase(unittest.TestCase):
class UserTestCase(TestCase):
'Test User'
@classmethod
+3 -3
View File
@@ -1,14 +1,14 @@
# 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
from trytond.model.exceptions import AccessError
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
from trytond.transaction import Transaction
class WizardTestCase(unittest.TestCase):
class WizardTestCase(TestCase):
@classmethod
def setUpClass(cls):
+3 -4
View File
@@ -1,13 +1,12 @@
# 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
from trytond.pool import Pool
from trytond.tests.test_tryton import activate_module, with_transaction
from trytond.tests.test_tryton import (
TestCase, activate_module, with_transaction)
class WorkflowTestCase(unittest.TestCase):
class WorkflowTestCase(TestCase):
@classmethod
def setUpClass(cls):
+2 -3
View File
@@ -1,16 +1,15 @@
# 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
from unittest.mock import Mock, sentinel
from trytond.exceptions import TrytonException
from trytond.protocols.wrappers import Response
from trytond.tests.test_tryton import Client
from trytond.tests.test_tryton import Client, TestCase
from trytond.wsgi import TrytondWSGI
class WSGIAppTestCase(unittest.TestCase):
class WSGIAppTestCase(TestCase):
'Test WSGI Application'
class TestException(TrytonException):