• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

testit-tms / adapters-python / 21142479550

19 Jan 2026 03:10PM UTC coverage: 33.144% (-4.2%) from 37.309%
21142479550

push

github

taipoxinous
fix: test result none issue

0 of 13 new or added lines in 2 files covered. (0.0%)

758 of 2287 relevant lines covered (33.14%)

1.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

67.06
/testit-python-commons/src/testit_python_commons/services/adapter_manager.py
1
import os
2✔
2
import uuid
2✔
3

4
from testit_python_commons.client.api_client import ApiClientWorker
2✔
5
from testit_python_commons.client.client_configuration import ClientConfiguration
2✔
6
from testit_python_commons.models.adapter_mode import AdapterMode
2✔
7
from testit_python_commons.models.test_result import TestResult
2✔
8
from testit_python_commons.services.fixture_manager import FixtureManager
2✔
9
from testit_python_commons.services.adapter_manager_configuration import AdapterManagerConfiguration
2✔
10
from testit_python_commons.services.logger import adapter_logger
2✔
11
from testit_python_commons.services.utils import Utils
2✔
12

13

14
class AdapterManager:
2✔
15
    def __init__(
2✔
16
            self,
17
            adapter_configuration: AdapterManagerConfiguration,
18
            client_configuration: ClientConfiguration,
19
            fixture_manager: FixtureManager):
20
        self.__config = adapter_configuration
2✔
21
        self.__api_client = ApiClientWorker(client_configuration)
2✔
22
        self.__fixture_manager = fixture_manager
2✔
23
        self.__test_result_map = {}
2✔
24
        self.__test_results = []
2✔
25

26
    @adapter_logger
2✔
27
    def set_test_run_id(self, test_run_id: str) -> None:
2✔
28
        self.__config.set_test_run_id(test_run_id)
2✔
29
        self.__api_client.set_test_run_id(test_run_id)
2✔
30

31
    @adapter_logger
2✔
32
    def get_test_run_id(self) -> str:
2✔
33
        if self.__config.get_mode() != AdapterMode.NEW_TEST_RUN:
2✔
34
            test_run_id = self.__config.get_test_run_id()
×
35

36
            self.__update_test_run_name(test_run_id)
×
37

38
            return test_run_id
×
39

40
        return self.__api_client.create_test_run(self.__config.get_test_run_name())
2✔
41

42
    @adapter_logger
2✔
43
    def __update_test_run_name(self, test_run_id: str) -> None:
2✔
44
        test_run_name = self.__config.get_test_run_name()
×
45

46
        if not test_run_name:
×
47
            return
×
48

49
        test_run = self.__api_client.get_test_run(test_run_id)
×
50

51
        if test_run_name == test_run.name:
×
52
            return
×
53

54
        test_run.name = test_run_name
×
55

56
        self.__api_client.update_test_run(test_run)
×
57

58
    @adapter_logger
2✔
59
    def get_autotests_for_launch(self):
2✔
60
        if self.__config.get_mode() == AdapterMode.USE_FILTER:
2✔
61
            return self.__api_client.get_external_ids_for_test_run_id()
2✔
62

63
        return
×
64

65
    @adapter_logger
2✔
66
    def write_test(self, test_result: TestResult) -> None:
2✔
67
        if self.__config.should_import_realtime():
×
68
            self.__write_test_realtime(test_result)
×
69

70
            return
×
71

72
        self.__test_results.append(test_result)
×
73

74
    @adapter_logger
2✔
75
    def __write_test_realtime(self, test_result: TestResult) -> None:
2✔
76
        test_result.set_automatic_creation_test_cases(
×
77
            self.__config.should_automatic_creation_test_cases())
78

NEW
79
        ext_id = test_result.get_external_id()
×
NEW
80
        test_result_id = self.__api_client.write_test(test_result)
×
81
      
NEW
82
        if (ext_id is None or test_result_id is None):
×
NEW
83
            logger.warning("test_result got empty external_id or test_result_id")
×
NEW
84
            logger.warning(test_result)
×
NEW
85
            return
×
86

NEW
87
        self.__test_result_map[ext_id] = test_result_id
×
88

89
    @adapter_logger
2✔
90
    def write_tests(self) -> None:
2✔
91
        if self.__config.should_import_realtime():
2✔
92
            self.__load_setup_and_teardown_step_results()
2✔
93

94
            return
2✔
95

96
        self.__write_tests_after_all()
×
97

98
    @adapter_logger
2✔
99
    def __load_setup_and_teardown_step_results(self) -> None:
2✔
100
        self.__api_client.update_test_results(self.__fixture_manager.get_all_items(), self.__test_result_map)
2✔
101

102
    @adapter_logger
2✔
103
    def __write_tests_after_all(self) -> None:
2✔
104
        fixtures = self.__fixture_manager.get_all_items()
×
105

106
        self.__api_client.write_tests(self.__test_results, fixtures)
×
107

108
    @adapter_logger
2✔
109
    def load_attachments(self, attach_paths: list or tuple):
2✔
110
        return self.__api_client.load_attachments(attach_paths)
2✔
111

112
    @adapter_logger
2✔
113
    def create_attachment(self, body, name: str):
2✔
114
        if name is None:
2✔
115
            name = str(uuid.uuid4()) + '-attachment.txt'
×
116

117
        path = os.path.join(os.path.abspath(''), name)
2✔
118

119
        with open(path, 'wb') as attached_file:
2✔
120
            attached_file.write(
2✔
121
                Utils.convert_body_of_attachment(body))
122

123
        attachment_id = self.__api_client.load_attachments((path,))
2✔
124

125
        os.remove(path)
2✔
126

127
        return attachment_id
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc