Coverage for tests/test_app/apps.py: 86%
16 statements
« prev ^ index » next coverage.py v7.3.4, created at 2024-01-20 18:02 +0000
« prev ^ index » next coverage.py v7.3.4, created at 2024-01-20 18:02 +0000
1from django.apps import AppConfig
2from django.conf import settings
3from django.core.checks import Error, register
6@register()
7def test_check(app_configs, **kwargs):
8 errors = []
9 if getattr(settings, "DJANGO_TYPER_FAIL_CHECK", False): 9 ↛ 18line 9 didn't jump to line 18, because the condition on line 9 was never false
10 errors.append(
11 Error(
12 "Test check error",
13 hint="Error thrown because settings_fail_check was used.",
14 obj=settings,
15 id="test_app.E001",
16 )
17 )
18 return errors
21class TestAppConfig(AppConfig):
22 name = "django_typer.tests.test_app"
23 label = name.replace(".", "_")
24 verbose_name = "Test App"
26 def ready(self):
27 if getattr(settings, "DJANGO_TYPER_THROW_TEST_EXCEPTION", False): 27 ↛ 28line 27 didn't jump to line 28, because the condition on line 27 was never true
28 raise Exception("Test ready exception")
30 # print(self.label)