Coverage for app/venv/lib/python3.14/site-packages/weblate/gitexport/apps.py: 77%

18 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 07:15 +0000

1# Copyright © Michal Čihař <michal@weblate.org> 

2# 

3# SPDX-License-Identifier: GPL-3.0-or-later 

4from __future__ import annotations 

5 

6from typing import TYPE_CHECKING 

7 

8from django.apps import AppConfig 

9from django.core.checks import register 

10 

11from weblate.gitexport.utils import find_git_http_backend 

12from weblate.utils.checks import weblate_check 

13 

14if TYPE_CHECKING: 14 ↛ 15line 14 didn't jump to line 15 because the condition on line 14 was never true

15 from collections.abc import Iterable, Sequence 

16 

17 from django.core.checks import CheckMessage 

18 

19 

20class GitExportConfig(AppConfig): 

21 name = "weblate.gitexport" 

22 label = "gitexport" 

23 verbose_name = "Git Exporter" 

24 

25 

26@register 

27def check_git_backend( 

28 *, 

29 app_configs: Sequence[AppConfig] | None, 

30 databases: Sequence[str] | None, 

31 **kwargs, 

32) -> Iterable[CheckMessage]: 

33 if find_git_http_backend() is None: 33 ↛ 34line 33 didn't jump to line 34 because the condition on line 33 was never true

34 return [ 

35 weblate_check( 

36 "weblate.E022", 

37 "Could not find git-http-backend, the git exporter will not work.", 

38 ) 

39 ] 

40 return []