Exemplo n.º 1
0
 def test_invalid_class(self):
     with self.assertRaisesRegex(
             ImproperlyConfigured,
             '"weblate.utils.tests.test_classloader"'
             ' does not define a "Foo" class',
     ):
         load_class("weblate.utils.tests.test_classloader.Foo", "TEST")
Exemplo n.º 2
0
 def test_invalid_module(self):
     with self.assertRaisesRegex(
             ImproperlyConfigured,
             'weblate.trans.tests.missing in TEST: "'
             "No module named .*missing[\"']",
     ):
         load_class("weblate.trans.tests.missing.Foo", "TEST")
Exemplo n.º 3
0
 def test_invalid_name(self):
     with self.assertRaisesRegex(
             ImproperlyConfigured,
             'Error importing class unittest in TEST: .*"'
             "(not enough|need more than)",
     ):
         load_class("unittest", "TEST")
Exemplo n.º 4
0
 def ensure_dummy_mt():
     """Ensure we have dummy mt installed."""
     if "dummy" in weblate.machinery.MACHINE_TRANSLATION_SERVICES:
         return
     name = "weblate.machinery.dummy.DummyTranslation"
     service = load_class(name, "TEST")()
     weblate.machinery.MACHINE_TRANSLATION_SERVICES[service.mtid] = service
Exemplo n.º 5
0
 def ensure_dummy_mt():
     """Ensure we have dummy mt installed"""
     if 'dummy' in MACHINE_TRANSLATION_SERVICES:
         return
     name = 'weblate.trans.machine.dummy.DummyTranslation'
     service = load_class(name, 'TEST')()
     MACHINE_TRANSLATION_SERVICES[service.mtid] = service
Exemplo n.º 6
0
 def ensure_dummy_mt():
     """Ensure we have dummy mt installed"""
     if 'dummy' in MACHINE_TRANSLATION_SERVICES:
         return
     name = 'weblate.machinery.dummy.DummyTranslation'
     service = load_class(name, 'TEST')()
     MACHINE_TRANSLATION_SERVICES[service.mtid] = service
Exemplo n.º 7
0
 def test_correct(self):
     cls = load_class('unittest.TestCase', 'TEST')
     self.assertEqual(cls, TestCase)
Exemplo n.º 8
0
 def test_correct(self):
     cls = load_class("unittest.TestCase", "TEST")
     self.assertEqual(cls, TestCase)
Exemplo n.º 9
0
 def test_correct(self):
     cls = load_class('unittest.TestCase', 'TEST')
     self.assertEqual(cls, TestCase)