testit-adapter-nose 3.5.0__tar.gz → 3.5.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: testit-adapter-nose
3
- Version: 3.5.0
3
+ Version: 3.5.2
4
4
  Summary: Nose adapter for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
6
6
  Author: Integration team
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Description-Content-Type: text/markdown
18
18
  Requires-Dist: attrs
19
19
  Requires-Dist: nose2
20
- Requires-Dist: testit-python-commons==3.5.0
20
+ Requires-Dist: testit-python-commons==3.5.2
21
21
  Dynamic: author
22
22
  Dynamic: author-email
23
23
  Dynamic: classifier
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- VERSION = "3.5.0"
3
+ VERSION = "3.5.2"
4
4
 
5
5
  setup(
6
6
  name='testit-adapter-nose',
@@ -25,7 +25,7 @@ setup(
25
25
  py_modules=['testit_adapter_nose'],
26
26
  packages=find_packages(where='src'),
27
27
  package_dir={'': 'src'},
28
- install_requires=['attrs', 'nose2', 'testit-python-commons==3.5.0'],
28
+ install_requires=['attrs', 'nose2', 'testit-python-commons==' + VERSION],
29
29
  entry_points={
30
30
  'nose.plugins.0.10': [
31
31
  'testit_adapter_nose = testit_adapter_nose.plugin:TmsPlugin',
@@ -30,17 +30,6 @@ def status_details(event):
30
30
  return message, trace
31
31
 
32
32
 
33
- def update_attrs(test, name, values):
34
- if type(values) in (list, tuple, str) and name.isidentifier():
35
- attrib = getattr(test, name, values)
36
- if attrib and attrib != values:
37
- attrib = sum(
38
- [tuple(i) if type(i) in (tuple, list) else (i,) for i in (attrib, values)],
39
- ()
40
- )
41
- setattr(test, name, attrib)
42
-
43
-
44
33
  def get_outcome(event):
45
34
  outcome = None
46
35
  message = None
@@ -65,68 +54,63 @@ def get_outcome(event):
65
54
 
66
55
 
67
56
  def form_test(item, top_level_directory):
68
- data = {}
69
-
70
- if hasattr(item, "_testFunc"):
71
- data = {
72
- 'externalID': __get_external_id_from(item),
73
- 'autoTestName': __get_display_name_from(item),
74
- 'steps': [],
75
- 'stepResults': [],
76
- 'setUp': [],
77
- 'setUpResults': [],
78
- 'tearDown': [],
79
- 'tearDownResults': [],
80
- 'resultLinks': [],
81
- 'duration': 0,
82
- 'outcome': None,
83
- 'failureReasonName': None,
84
- 'traces': None,
85
- 'attachments': [],
86
- 'parameters': get_all_parameters(item),
87
- 'properties': __get_properties_from(item),
88
- 'namespace': __get_namespace_from(item),
89
- 'classname': __get_class_name_from(item),
90
- 'title': __get_title_from(item),
91
- 'description': __get_description_from(item),
92
- 'links': __get_links_from(item),
93
- 'labels': __get_labels_from(item),
94
- 'workItemsID': __get_work_item_ids_from(item),
95
- 'message': None,
96
- 'externalKey': __get_fullname(item, top_level_directory)
97
- }
98
-
99
- elif hasattr(item, "_testMethodName"):
100
- data = {
101
- 'externalID': get_hash(item._testMethodName),
102
- 'autoTestName': item.__doc__ if item.__doc__ else item._testMethodName,
103
- 'parameters': get_all_parameters(item)
104
- }
105
-
106
- return data
107
-
108
-
109
- def __get_display_name_from(item):
110
- display_name = __search_attribute(item, 'test_displayname')
57
+ if hasattr(item, '_testFunc'):
58
+ function = item._testFunc
59
+ elif hasattr(item, '_testMethodName'):
60
+ function = getattr(item.__class__, item._testMethodName)
61
+ else:
62
+ raise Exception('')
63
+
64
+ return {
65
+ 'externalID': __get_external_id_from(item, function),
66
+ 'autoTestName': __get_display_name_from(item, function),
67
+ 'steps': [],
68
+ 'stepResults': [],
69
+ 'setUp': [],
70
+ 'setUpResults': [],
71
+ 'tearDown': [],
72
+ 'tearDownResults': [],
73
+ 'resultLinks': [],
74
+ 'duration': 0,
75
+ 'outcome': None,
76
+ 'failureReasonName': None,
77
+ 'traces': None,
78
+ 'attachments': [],
79
+ 'parameters': get_all_parameters(item),
80
+ 'properties': __get_properties_from(function),
81
+ 'namespace': __get_namespace_from(item, function),
82
+ 'classname': __get_class_name_from(item, function),
83
+ 'title': __get_title_from(item, function),
84
+ 'description': __get_description_from(item, function),
85
+ 'links': __get_links_from(item, function),
86
+ 'labels': __get_labels_from(item, function),
87
+ 'workItemsID': __get_work_item_ids_from(item, function),
88
+ 'message': None,
89
+ 'externalKey': __get_fullname(function, top_level_directory)
90
+ }
91
+
92
+
93
+ def __get_display_name_from(item, function):
94
+ display_name = __search_attribute(function, 'test_displayname')
111
95
 
112
96
  if not display_name:
113
- return item._testFunc.__doc__ if \
114
- item._testFunc.__doc__ else item._testFunc.__name__
97
+ return function.__doc__ if \
98
+ function.__doc__ else function.__name__
115
99
 
116
100
  return collect_parameters_in_string_attribute(display_name, get_all_parameters(item))
117
101
 
118
102
 
119
- def __get_external_id_from(item):
120
- external_id = __search_attribute(item, 'test_external_id')
103
+ def __get_external_id_from(item, function):
104
+ external_id = __search_attribute(function, 'test_external_id')
121
105
 
122
106
  if not external_id:
123
- return get_hash(item._testFunc.__qualname__ + item._testFunc.__name__)
107
+ return get_hash(function.__qualname__ + function.__name__)
124
108
 
125
109
  return collect_parameters_in_string_attribute(external_id, get_all_parameters(item))
126
110
 
127
111
 
128
- def __get_title_from(item):
129
- title = __search_attribute(item, 'test_title')
112
+ def __get_title_from(item, function):
113
+ title = __search_attribute(function, 'test_title')
130
114
 
131
115
  if not title:
132
116
  return None
@@ -134,8 +118,8 @@ def __get_title_from(item):
134
118
  return collect_parameters_in_string_attribute(title, get_all_parameters(item))
135
119
 
136
120
 
137
- def __get_description_from(item):
138
- description = __search_attribute(item, 'test_description')
121
+ def __get_description_from(item, function):
122
+ description = __search_attribute(function, 'test_description')
139
123
 
140
124
  if not description:
141
125
  return None
@@ -143,31 +127,31 @@ def __get_description_from(item):
143
127
  return collect_parameters_in_string_attribute(description, get_all_parameters(item))
144
128
 
145
129
 
146
- def __get_namespace_from(item):
147
- namespace = __search_attribute(item, 'test_namespace')
130
+ def __get_namespace_from(item, function):
131
+ namespace = __search_attribute(function, 'test_namespace')
148
132
 
149
133
  if not namespace:
150
- return item._testFunc.__module__
134
+ return function.__module__
151
135
 
152
136
  return collect_parameters_in_string_attribute(namespace, get_all_parameters(item))
153
137
 
154
138
 
155
- def __get_class_name_from(item):
156
- class_name = __search_attribute(item, 'test_classname')
139
+ def __get_class_name_from(item, function):
140
+ class_name = __search_attribute(function, 'test_classname')
157
141
 
158
142
  if not class_name:
159
- i = item._testFunc.__qualname__.find('.')
143
+ i = function.__qualname__.find('.')
160
144
 
161
145
  if i != -1:
162
- return item._testFunc.__qualname__[:i]
146
+ return func.__qualname__[:i]
163
147
 
164
148
  return None
165
149
 
166
150
  return collect_parameters_in_string_attribute(class_name, get_all_parameters(item))
167
151
 
168
152
 
169
- def __get_links_from(item):
170
- links = __search_attribute(item, 'test_links')
153
+ def __get_links_from(item, function):
154
+ links = __search_attribute(function, 'test_links')
171
155
 
172
156
  if not links:
173
157
  return []
@@ -175,19 +159,8 @@ def __get_links_from(item):
175
159
  return __set_parameters_to_links(links, get_all_parameters(item))
176
160
 
177
161
 
178
- def __get_parameters_from(item):
179
- if hasattr(item, 'array_parametrize_mark_id'):
180
- test_parameters = {}
181
- for key, parameter in item.callspec.params.items():
182
- test_parameters[key] = str(parameter)
183
- return test_parameters
184
- return None
185
-
186
-
187
- def __get_properties_from(item):
188
- if hasattr(item, 'test_properties'):
189
- return item.test_properties
190
- return None
162
+ def __get_properties_from(function):
163
+ return __search_attribute(function, 'test_properties')
191
164
 
192
165
 
193
166
  def __set_parameters_to_links(links, all_parameters):
@@ -219,8 +192,8 @@ def __set_parameters_to_links(links, all_parameters):
219
192
  return links_with_parameters
220
193
 
221
194
 
222
- def __get_labels_from(item):
223
- test_labels = __search_attribute(item, 'test_labels')
195
+ def __get_labels_from(item, function):
196
+ test_labels = __search_attribute(function, 'test_labels')
224
197
 
225
198
  if not test_labels:
226
199
  return []
@@ -245,8 +218,8 @@ def __get_labels_from(item):
245
218
  return labels
246
219
 
247
220
 
248
- def __get_work_item_ids_from(item):
249
- test_workitems_id = __search_attribute(item, 'test_workitems_id')
221
+ def __get_work_item_ids_from(item, function):
222
+ test_workitems_id = __search_attribute(function, 'test_workitems_id')
250
223
 
251
224
  if not test_workitems_id:
252
225
  return []
@@ -261,17 +234,16 @@ def __get_work_item_ids_from(item):
261
234
  return map(str, result) if isinstance(result, __ARRAY_TYPES) else [str(result)]
262
235
 
263
236
 
264
- def __get_fullname(item, top_level_directory: str):
265
- test_function = item._testFunc
266
- module_file_name = __get_module_file_name_by_test_function(test_function)
237
+ def __get_fullname(function, top_level_directory: str):
238
+ module_file_name = __get_module_file_name_by_test_function(function)
267
239
 
268
240
  if not module_file_name:
269
- return __join_nose_test_node([test_function.__module__, test_function.__qualname__])
241
+ return __join_nose_test_node([function.__module__, function.__qualname__])
270
242
 
271
243
  absolute_module_path = __get_absolute_module_path_by_file_name(module_file_name)
272
244
  module_node = __convert_absolute_module_path_to_nose_module_node(absolute_module_path, top_level_directory)
273
245
 
274
- return __join_nose_test_node([module_node, test_function.__module__, test_function.__qualname__])
246
+ return __join_nose_test_node([module_node, function.__module__, function.__qualname__])
275
247
 
276
248
 
277
249
  def __get_module_file_name_by_test_function(test_function):
@@ -292,18 +264,9 @@ def __join_nose_test_node(test_node_parts: typing.List[str]):
292
264
  return ".".join(test_node_parts)
293
265
 
294
266
 
295
- def fullname(event):
296
- if hasattr(event.test, "_testFunc"):
297
- test_module = event.test._testFunc.__module__
298
- test_name = event.test._testFunc.__name__
299
- return f"{test_module}.{test_name}"
300
- test_id = event.test.id()
301
- return test_id.split(":")[0]
302
-
303
-
304
- def __search_attribute(item, attribute):
305
- if hasattr(item._testFunc, attribute):
306
- return getattr(item._testFunc, attribute)
267
+ def __search_attribute(func, attribute):
268
+ if hasattr(func, attribute):
269
+ return getattr(func, attribute)
307
270
 
308
271
  return
309
272
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: testit-adapter-nose
3
- Version: 3.5.0
3
+ Version: 3.5.2
4
4
  Summary: Nose adapter for Test IT
5
5
  Home-page: https://github.com/testit-tms/adapters-python/
6
6
  Author: Integration team
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Description-Content-Type: text/markdown
18
18
  Requires-Dist: attrs
19
19
  Requires-Dist: nose2
20
- Requires-Dist: testit-python-commons==3.5.0
20
+ Requires-Dist: testit-python-commons==3.5.2
21
21
  Dynamic: author
22
22
  Dynamic: author-email
23
23
  Dynamic: classifier
@@ -0,0 +1,3 @@
1
+ attrs
2
+ nose2
3
+ testit-python-commons==3.5.2
@@ -1,3 +0,0 @@
1
- attrs
2
- nose2
3
- testit-python-commons==3.5.0