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

testit-tms / adapters-python / 21937415766

12 Feb 2026 07:26AM UTC coverage: 37.16% (-4.1%) from 41.236%
21937415766

Pull #234

github

web-flow
Merge e908d8a92 into 2fcd27f6a
Pull Request #234: feat: TMS-37545: replace labels with tags when collecting autotest me…

17 of 73 new or added lines in 11 files covered. (23.29%)

2 existing lines in 2 files now uncovered.

1337 of 3598 relevant lines covered (37.16%)

0.74 hits per line

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

49.11
/testit-python-commons/src/testit_python_commons/dynamic_methods.py
1
import logging
2✔
2

3
from testit_python_commons.services import TmsPluginManager
2✔
4
from testit_python_commons.services.logger import adapter_logger
2✔
5
from testit_python_commons.services.utils import Utils
2✔
6

7

8
@Utils.deprecated('Use "addLinks" instead.')
2✔
9
@adapter_logger
2✔
10
def addLink(url: str, title: str = None, type: str = None, description: str = None):  # noqa: A002,VNE003,N802
2✔
11
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_link'):
2✔
12
        TmsPluginManager.get_plugin_manager().hook \
2✔
13
            .add_link(
14
            link=Utils.convert_link_dict_to_link_model({
15
                "url": url,
16
                "title": title,
17
                "type": type,
18
                "description": description}))
19

20

21
@adapter_logger
2✔
22
def addLinks(url: str = None, title: str = None, type: str = None, description: str = None,  # noqa: A002,VNE003,N802
2✔
23
             links: list or tuple = None):
24
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_link'):
2✔
25
        if url:
2✔
26
            TmsPluginManager.get_plugin_manager().hook \
2✔
27
                .add_link(
28
                link=Utils.convert_link_dict_to_link_model({
29
                    "url": url,
30
                    "title": title,
31
                    "type": type,
32
                    "description": description}))
33
        elif links and (isinstance(links, list) or isinstance(links, tuple)):
2✔
34
            for link in links:
2✔
35
                if isinstance(link, dict) and 'url' in link:
2✔
36
                    TmsPluginManager.get_plugin_manager().hook \
2✔
37
                        .add_link(link=Utils.convert_link_dict_to_link_model(link))
38
                else:
39
                    logging.warning(f'Link ({link}) can\'t be processed!')
×
40
        else:
41
            logging.warning("Links can't be processed!\nPlease, set 'url' or 'links'!")
×
42

43

44
@Utils.deprecated('Use "addMessage" instead.')
2✔
45
@adapter_logger
2✔
46
def message(test_message: str):
2✔
47
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_message'):
×
48
        TmsPluginManager.get_plugin_manager().hook \
×
49
            .add_message(test_message=test_message)
50

51

52
@adapter_logger
2✔
53
def addMessage(test_message: str):   # noqa: N802
2✔
54
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_message'):
2✔
55
        TmsPluginManager.get_plugin_manager().hook \
2✔
56
            .add_message(test_message=test_message)
57

58

59
@Utils.deprecated('Use "addAttachments" instead.')
2✔
60
@adapter_logger
2✔
61
def attachments(*attachments_paths):
2✔
62
    active_step = TmsPluginManager.get_step_manager().get_active_step()
×
63

64
    if active_step:
×
65
        attachment_ids = TmsPluginManager.get_adapter_manager().load_attachments(attachments_paths)
×
66

67
        active_step.set_attachments(active_step.get_attachments() + attachment_ids)
×
68
    else:
69
        if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_attachments'):
×
70
            TmsPluginManager.get_plugin_manager().hook \
×
71
                .add_attachments(attach_paths=attachments_paths)
72

73

74
@adapter_logger
2✔
75
def addAttachments(data, is_text: bool = False, name: str = None):   # noqa: N802
2✔
76
    active_step = TmsPluginManager.get_step_manager().get_active_step()
×
77

78
    if active_step:
×
79
        add_attachments_to_step(active_step, data, is_text, name)
×
80
    else:
81
        add_attachments_to_test(data, is_text, name)
×
82

83

84
@adapter_logger
2✔
85
def add_attachments_to_step(step, data, is_text: bool = False, name: str = None):
2✔
86
    if is_text:
×
87
        attachment_ids = TmsPluginManager.get_adapter_manager().create_attachment(data, name)
×
88
    else:
89
        if isinstance(data, str):
×
90
            attachment_ids = TmsPluginManager.get_adapter_manager().load_attachments([data])
×
91
        elif isinstance(data, tuple) or isinstance(data, list):
×
92
            attachment_ids = TmsPluginManager.get_adapter_manager().load_attachments(data)
×
93
        else:
94
            logging.warning(f'File ({data}) not found!')
×
95
            return
×
96

97
    step.set_attachments(step.get_attachments() + attachment_ids)
×
98

99

100
@adapter_logger
2✔
101
def add_attachments_to_test(data, is_text: bool = False, name: str = None):
2✔
102
    if is_text and hasattr(TmsPluginManager.get_plugin_manager().hook, 'create_attachment'):
×
103
        TmsPluginManager.get_plugin_manager().hook \
×
104
            .create_attachment(
105
            body=data,
106
            name=name)
107
    elif hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_attachments'):
×
108
        if isinstance(data, str):
×
109
            TmsPluginManager.get_plugin_manager().hook \
×
110
                .add_attachments(attach_paths=[data])
111
        elif isinstance(data, tuple) or isinstance(data, list):
×
112
            TmsPluginManager.get_plugin_manager().hook \
×
113
                .add_attachments(attach_paths=data)
114
        else:
115
            logging.warning(f'({data}) is not path!')
×
116

117

118
@adapter_logger
2✔
119
def addWorkItemIds(*test_work_item_ids: int or str):  # noqa: N802
2✔
120
    if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_work_item_id'):
×
121
        return
×
122

123
    for test_work_item_id in test_work_item_ids:
×
124
        TmsPluginManager.get_plugin_manager().hook.add_work_item_id(test_work_item_id=str(test_work_item_id))
×
125

126

127
@adapter_logger
2✔
128
def addDisplayName(test_display_name: str):  # noqa: N802
2✔
129
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_display_name'):
×
130
        TmsPluginManager.get_plugin_manager().hook \
×
131
            .add_display_name(test_display_name=str(test_display_name))
132

133

134
@adapter_logger
2✔
135
def addNameSpace(test_namespace: str):  # noqa: N802
2✔
136
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_namespace'):
×
137
        TmsPluginManager.get_plugin_manager().hook \
×
138
            .add_namespace(test_namespace=str(test_namespace))
139

140

141
@adapter_logger
2✔
142
def addClassName(test_classname: str):  # noqa: N802
2✔
143
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_classname'):
×
144
        TmsPluginManager.get_plugin_manager().hook \
×
145
            .add_classname(test_classname=str(test_classname))
146

147

148
@adapter_logger
2✔
149
def addExternalId(test_external_id: str):  # noqa: N802
2✔
150
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_external_id'):
×
151
        TmsPluginManager.get_plugin_manager().hook \
×
152
            .add_external_id(test_external_id=str(test_external_id))
153

154

155
@adapter_logger
2✔
156
def addTitle(test_title: str):
2✔
157
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_title'):
×
158
        TmsPluginManager.get_plugin_manager().hook \
×
159
            .add_title(test_title=str(test_title))
160

161

162
@adapter_logger
2✔
163
def addDescription(test_description: str):
2✔
164
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_description'):
×
165
        TmsPluginManager.get_plugin_manager().hook \
×
166
            .add_description(test_description=str(test_description))
167

168

169
@Utils.deprecated('Use "addTags" instead.')
2✔
170
@adapter_logger
2✔
171
def addLabels(*test_labels: str):
2✔
172
    if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_label'):
×
173
        return
×
174

175
    for test_label in test_labels:
×
176
        TmsPluginManager.get_plugin_manager().hook.add_label(test_label=str(test_label))
×
177

178

179
@adapter_logger
2✔
180
def addTags(*test_tags: str):
2✔
NEW
181
    if not hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_tag'):
×
NEW
182
        return
×
183

NEW
184
    for test_tag in test_tags:
×
NEW
185
        TmsPluginManager.get_plugin_manager().hook.add_tag(test_tag=str(test_tag))
×
186

187

188
@adapter_logger
2✔
189
def addParameter(name: str, value: str):
2✔
190
    if hasattr(TmsPluginManager.get_plugin_manager().hook, 'add_parameter'):
×
191
        TmsPluginManager.get_plugin_manager().hook \
×
192
            .add_parameter(name=str(name), value=str(value))
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