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

testit-tms / adapters-python / 21520479975

30 Jan 2026 03:09PM UTC coverage: 37.23% (-0.003%) from 37.233%
21520479975

push

github

web-flow
fix: fix TMS-37357 issue with externalId html (#227)

1 of 5 new or added lines in 3 files covered. (20.0%)

1328 of 3567 relevant lines covered (37.23%)

0.74 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
×
NEW
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):
×
NEW
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

127
@adapter_logger
×
128
def labels(*test_labels: str):
×
129
    def outer(function):
×
130
        function.test_labels = test_labels
×
131
        return inner(function)
×
132

133
    return outer
×
134

135

136
@Utils.deprecated('Use "links" instead.')
×
137
@adapter_logger
×
138
def link(url: str, title: str = None, type: str = None, description: str = None):  # noqa: A002,VNE003
×
139
    def outer(function):
×
140
        if not hasattr(function, 'test_links'):
×
141
            function.test_links = []
×
142

143
        function.test_links.append(
×
144
            Utils.convert_link_dict_to_link_model({
145
                "url": url,
146
                "title": title,
147
                "type": type,
148
                "description": description}))
149

150
        return inner(function)
×
151

152
    return outer
×
153

154

155
@adapter_logger
×
156
def links(url: str = None, title: str = None, type: str = None,  # noqa: A002,VNE003
×
157
          description: str = None, links: list or tuple = None):
158
    def outer(function):
×
159
        if not hasattr(function, 'test_links'):
×
160
            function.test_links = []
×
161

162
        if url:
×
163
            function.test_links.append(
×
164
                Utils.convert_link_dict_to_link_model({
165
                    "url": url,
166
                    "title": title,
167
                    "type": type,
168
                    "description": description}))
169
        elif links and (isinstance(links, list) or isinstance(links, tuple)):
×
170
            for link in links:
×
171
                if isinstance(link, dict) and 'url' in link:
×
172
                    function.test_links.append(
×
173
                        Utils.convert_link_dict_to_link_model(link))
174
                else:
175
                    logging.warning(f'Link ({link}) can\'t be processed!')
×
176
        else:
177
            logging.warning(f'Links for {function.__name__} can\'t be processed!\nPlease, set "url" or "links"!')
×
178
        return inner(function)
×
179

180
    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