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

testit-tms / adapters-python / 22072083504

16 Feb 2026 05:23PM UTC coverage: 38.156% (-3.1%) from 41.236%
22072083504

Pull #234

github

web-flow
Merge a884e5000 into 44a4e9f3f
Pull Request #234: feat: TMS-37545: replace labels with tags when collecting autotest me…

20 of 86 new or added lines in 11 files covered. (23.26%)

11 existing lines in 1 file now uncovered.

1411 of 3698 relevant lines covered (38.16%)

0.76 hits per line

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

0.0
/testit-python-commons/src/testit_python_commons/decorators.py
1
import asyncio
×
2
import inspect
×
3
import logging
×
4
import types
×
5
from functools import wraps
×
6

7
from testit_python_commons.services.logger import adapter_logger
×
8
from testit_python_commons.services.utils import Utils
×
9

10

11
def inner(function):
×
12
    def set_properties(kwargs):
×
13
        if not hasattr(function, 'test_properties') and kwargs:
×
14
            function.test_properties = {}
×
15

16
            for key, value in kwargs.items():
×
17
                if hasattr(function,
×
18
                           'callspec') and key not in function.callspec.params:
19
                    function.test_properties[key] = str(value)
×
20

21
    @wraps(function)
×
22
    def sync_wrapper(*args, **kwargs):
×
23
        set_properties(kwargs)
×
24
        function(*args, **kwargs)
×
25

26
    @wraps(function)
×
27
    async def async_wrapper(*args, **kwargs):
×
28
        set_properties(kwargs)
×
29
        await function(*args, **kwargs)
×
30

31
    if isinstance(function, types.FunctionType):
×
32
        if inspect.iscoroutinefunction(function):
×
33
            return async_wrapper
×
34

35
        return sync_wrapper
×
36

37
    return function
×
38

39

40
@Utils.deprecated('Use "workItemIds" instead.')
×
41
@adapter_logger
×
42
def workItemID(*test_workitems_id: int or str):  # noqa: N802
×
43
    def outer(function):
×
44
        function.test_workitems_id = []
×
45
        for test_workitem_id in test_workitems_id:
×
46
            function.test_workitems_id.append(str(test_workitem_id))
×
47
        return inner(function)
×
48

49
    return outer
×
50

51

52
@adapter_logger
×
53
def workItemIds(*test_workitems_id: int or str):  # noqa: N802
×
54
    def outer(function):  # noqa: N802
×
55
        function.test_workitems_id = []
×
56
        for test_workitem_id in test_workitems_id:
×
57
            function.test_workitems_id.append(str(test_workitem_id))
×
58
        return inner(function)
×
59

60
    return outer
×
61

62

63
@adapter_logger
×
64
def displayName(test_displayname: str):  # noqa: N802
×
65
    def outer(function):
×
66
        function.test_displayname = test_displayname
×
67
        return inner(function)
×
68

69
    return outer
×
70

71

72
@adapter_logger
×
73
def nameSpace(test_namespace: str):  # noqa: N802
×
74
    def outer(function):
×
75
        function.test_namespace = test_namespace
×
76
        return inner(function)
×
77

78
    return outer
×
79

80

81
@adapter_logger
×
82
def className(test_classname: str):  # noqa: N802
×
83
    def outer(function):
×
84
        function.test_classname = test_classname
×
85
        return inner(function)
×
86

87
    return outer
×
88

89

90
@Utils.deprecated('Use "externalId" instead.')
×
91
@adapter_logger
×
92
def externalID(test_external_id: str):  # noqa: N802
×
93
    def outer(function):
×
94
        function.test_external_id = test_external_id
×
95
        return inner(function)
×
96

97
    return outer
×
98

99

100
@adapter_logger
×
101
def externalId(test_external_id: str):  # noqa: N802
×
102
    def outer(function):
×
103
        function.test_external_id = test_external_id
×
104
        return inner(function)
×
105

106
    return outer
×
107

108

109
@adapter_logger
×
110
def title(test_title: str):
×
111
    def outer(function):
×
112
        function.test_title = test_title
×
113
        return inner(function)
×
114

115
    return outer
×
116

117

118
@adapter_logger
×
119
def description(test_description: str):
×
120
    def outer(function):
×
121
        function.test_description = test_description
×
122
        return inner(function)
×
123

124
    return outer
×
125

126

NEW
127
@Utils.deprecated('Use "tags" instead.')
×
128
@adapter_logger
×
129
def labels(*test_labels: str):
×
130
    def outer(function):
×
131
        function.test_labels = test_labels
×
132
        return inner(function)
×
133

134
    return outer
×
135

136

NEW
137
@adapter_logger
×
NEW
138
def tags(*test_tags: str):
×
NEW
139
    def outer(function):
×
NEW
140
        function.test_tags = test_tags
×
NEW
141
        return inner(function)
×
142

NEW
143
    return outer
×
144

145

146
@Utils.deprecated('Use "links" instead.')
×
147
@adapter_logger
×
148
def link(url: str, title: str = None, type: str = None, description: str = None):  # noqa: A002,VNE003
×
149
    def outer(function):
×
150
        if not hasattr(function, 'test_links'):
×
151
            function.test_links = []
×
152

153
        function.test_links.append(
×
154
            Utils.convert_link_dict_to_link_model({
155
                "url": url,
156
                "title": title,
157
                "type": type,
158
                "description": description}))
159

160
        return inner(function)
×
161

162
    return outer
×
163

164

165
@adapter_logger
×
166
def links(url: str = None, title: str = None, type: str = None,  # noqa: A002,VNE003
×
167
          description: str = None, links: list or tuple = None):
168
    def outer(function):
×
169
        if not hasattr(function, 'test_links'):
×
170
            function.test_links = []
×
171

172
        if url:
×
173
            function.test_links.append(
×
174
                Utils.convert_link_dict_to_link_model({
175
                    "url": url,
176
                    "title": title,
177
                    "type": type,
178
                    "description": description}))
179
        elif links and (isinstance(links, list) or isinstance(links, tuple)):
×
180
            for link in links:
×
181
                if isinstance(link, dict) and 'url' in link:
×
182
                    function.test_links.append(
×
183
                        Utils.convert_link_dict_to_link_model(link))
184
                else:
185
                    logging.warning(f'Link ({link}) can\'t be processed!')
×
186
        else:
187
            logging.warning(f'Links for {function.__name__} can\'t be processed!\nPlease, set "url" or "links"!')
×
188
        return inner(function)
×
189

190
    return outer
×
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