testit-adapter-pytest 3.0.1__tar.gz → 3.0.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.
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/PKG-INFO +2 -2
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/setup.py +2 -2
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/listener.py +14 -25
- testit_adapter_pytest-3.0.2/src/testit_adapter_pytest/models/executable_test.py +31 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/models/fixture.py +1 -1
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/utils.py +48 -58
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest.egg-info/PKG-INFO +2 -2
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest.egg-info/SOURCES.txt +1 -0
- testit_adapter_pytest-3.0.2/src/testit_adapter_pytest.egg-info/requires.txt +4 -0
- testit_adapter_pytest-3.0.1/src/testit_adapter_pytest.egg-info/requires.txt +0 -4
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/README.md +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/setup.cfg +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/__init__.py +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/fixture_context.py +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/fixture_manager.py +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/fixture_storage.py +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/models/__init__.py +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/plugin.py +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest.egg-info/dependency_links.txt +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest.egg-info/entry_points.txt +0 -0
- {testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: testit-adapter-pytest
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.2
|
|
4
4
|
Summary: Pytest adapter for Test IT
|
|
5
5
|
Home-page: https://github.com/testit-tms/adapters-python/
|
|
6
6
|
Author: Integration team
|
|
@@ -18,7 +18,7 @@ Description-Content-Type: text/markdown
|
|
|
18
18
|
Requires-Dist: pytest
|
|
19
19
|
Requires-Dist: pytest-xdist
|
|
20
20
|
Requires-Dist: attrs
|
|
21
|
-
Requires-Dist: testit-python-commons==3.0.
|
|
21
|
+
Requires-Dist: testit-python-commons==3.0.2
|
|
22
22
|
|
|
23
23
|
# Test IT TMS adapter for Pytest
|
|
24
24
|
|
|
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='testit-adapter-pytest',
|
|
5
|
-
version='3.0.
|
|
5
|
+
version='3.0.2',
|
|
6
6
|
description='Pytest adapter for Test IT',
|
|
7
7
|
long_description=open('README.md', "r").read(),
|
|
8
8
|
long_description_content_type="text/markdown",
|
|
@@ -23,6 +23,6 @@ setup(
|
|
|
23
23
|
py_modules=['testit_adapter_pytest'],
|
|
24
24
|
packages=find_packages(where='src'),
|
|
25
25
|
package_dir={'': 'src'},
|
|
26
|
-
install_requires=['pytest', 'pytest-xdist', 'attrs', 'testit-python-commons==3.0.
|
|
26
|
+
install_requires=['pytest', 'pytest-xdist', 'attrs', 'testit-python-commons==3.0.2'],
|
|
27
27
|
entry_points={'pytest11': ['testit_adapter_pytest = testit_adapter_pytest.plugin']}
|
|
28
28
|
)
|
{testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/listener.py
RENAMED
|
@@ -207,12 +207,6 @@ class TmsListener(object):
|
|
|
207
207
|
name = f'{fixture_name}::{finalizer_name}'
|
|
208
208
|
finalizers[index] = FixtureContext(finalizer, parent_uuid=container_uuid, name=name)
|
|
209
209
|
|
|
210
|
-
if self.__executable_test:
|
|
211
|
-
results_steps_data = self.__step_manager.get_steps_tree()
|
|
212
|
-
|
|
213
|
-
if fixturedef.scope == 'function':
|
|
214
|
-
self.__executable_test['setUpResults'] += results_steps_data
|
|
215
|
-
|
|
216
210
|
@pytest.hookimpl(hookwrapper=True, trylast=True)
|
|
217
211
|
def pytest_runtest_call(self):
|
|
218
212
|
yield
|
|
@@ -221,18 +215,13 @@ class TmsListener(object):
|
|
|
221
215
|
return
|
|
222
216
|
|
|
223
217
|
test_results_steps = self.__step_manager.get_steps_tree()
|
|
224
|
-
self.__executable_test
|
|
218
|
+
self.__executable_test.step_results = test_results_steps
|
|
225
219
|
|
|
226
220
|
@pytest.hookimpl(hookwrapper=True)
|
|
227
221
|
def pytest_fixture_post_finalizer(self, fixturedef):
|
|
228
222
|
if not self.__executable_test:
|
|
229
223
|
return
|
|
230
224
|
|
|
231
|
-
teardown_results_steps = self.__step_manager.get_steps_tree()
|
|
232
|
-
|
|
233
|
-
if fixturedef.scope == 'function':
|
|
234
|
-
self.__executable_test['tearDownResults'] += teardown_results_steps
|
|
235
|
-
|
|
236
225
|
yield
|
|
237
226
|
|
|
238
227
|
if hasattr(fixturedef, 'cached_result') and self._cache.get(fixturedef):
|
|
@@ -243,28 +232,28 @@ class TmsListener(object):
|
|
|
243
232
|
def pytest_runtest_logreport(self, report):
|
|
244
233
|
if self.__executable_test:
|
|
245
234
|
if report.when == 'setup':
|
|
246
|
-
self.__executable_test
|
|
235
|
+
self.__executable_test.outcome = STATUS.get(report.outcome, None)
|
|
247
236
|
if report.longreprtext:
|
|
248
|
-
self.__executable_test
|
|
237
|
+
self.__executable_test.message = report.longreprtext
|
|
249
238
|
|
|
250
239
|
if report.when == 'call':
|
|
251
|
-
self.__executable_test
|
|
240
|
+
self.__executable_test.outcome = STATUS.get(report.outcome, None)
|
|
252
241
|
|
|
253
242
|
if report.failed or hasattr(report, 'wasxfail') \
|
|
254
243
|
and not report.passed or report.outcome == 'rerun':
|
|
255
|
-
self.__executable_test
|
|
244
|
+
self.__executable_test.outcome = STATUS.get('failed', None)
|
|
256
245
|
|
|
257
246
|
if report.longreprtext:
|
|
258
|
-
self.__executable_test
|
|
247
|
+
self.__executable_test.traces = report.longreprtext
|
|
259
248
|
|
|
260
|
-
self.__executable_test
|
|
249
|
+
self.__executable_test.duration += report.duration * 1000
|
|
261
250
|
|
|
262
251
|
@pytest.hookimpl
|
|
263
252
|
def pytest_runtest_logfinish(self):
|
|
264
253
|
if not self.__executable_test:
|
|
265
254
|
return
|
|
266
255
|
|
|
267
|
-
self.__test_result_ids[self.__executable_test
|
|
256
|
+
self.__test_result_ids[self.__executable_test.node_id] = self.__adapter_manager.write_test(
|
|
268
257
|
utils.convert_executable_test_to_test_result_model(self.__executable_test))
|
|
269
258
|
|
|
270
259
|
@pytest.hookimpl
|
|
@@ -281,22 +270,22 @@ class TmsListener(object):
|
|
|
281
270
|
@adapter.hookimpl
|
|
282
271
|
def add_link(self, link):
|
|
283
272
|
if self.__executable_test:
|
|
284
|
-
self.__executable_test
|
|
273
|
+
self.__executable_test.result_links.append(link)
|
|
285
274
|
|
|
286
275
|
@adapter.hookimpl
|
|
287
276
|
def add_message(self, test_message):
|
|
288
277
|
if self.__executable_test:
|
|
289
|
-
self.__executable_test
|
|
278
|
+
self.__executable_test.message = str(test_message)
|
|
290
279
|
|
|
291
280
|
@adapter.hookimpl
|
|
292
281
|
def add_attachments(self, attach_paths: list or tuple):
|
|
293
282
|
if self.__executable_test:
|
|
294
|
-
self.__executable_test
|
|
283
|
+
self.__executable_test.attachments += self.__adapter_manager.load_attachments(attach_paths)
|
|
295
284
|
|
|
296
285
|
@adapter.hookimpl
|
|
297
286
|
def create_attachment(self, body, name: str):
|
|
298
287
|
if self.__executable_test:
|
|
299
|
-
self.__executable_test
|
|
288
|
+
self.__executable_test.attachments += self.__adapter_manager.create_attachment(body, name)
|
|
300
289
|
|
|
301
290
|
@adapter.hookimpl
|
|
302
291
|
def start_fixture(self, parent_uuid, uuid, title):
|
|
@@ -322,8 +311,8 @@ class TmsListener(object):
|
|
|
322
311
|
group_uuid = self._cache.push(fixturedef)
|
|
323
312
|
group = FixturesContainer(uuid=group_uuid)
|
|
324
313
|
self.fixture_manager.start_group(group_uuid, group)
|
|
325
|
-
if item.
|
|
326
|
-
self.fixture_manager.update_group(group_uuid,
|
|
314
|
+
if item.nodeid not in group.node_ids:
|
|
315
|
+
self.fixture_manager.update_group(group_uuid, node_ids=item.nodeid)
|
|
327
316
|
|
|
328
317
|
|
|
329
318
|
def _test_fixtures(item):
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from attr import attrs, attrib
|
|
2
|
+
from attr import Factory
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@attrs
|
|
6
|
+
class ExecutableTest:
|
|
7
|
+
external_id = attrib()
|
|
8
|
+
name = attrib()
|
|
9
|
+
steps = attrib(default=Factory(list))
|
|
10
|
+
step_results = attrib(default=Factory(list))
|
|
11
|
+
setup_steps = attrib(default=Factory(list))
|
|
12
|
+
setup_step_results = attrib(default=Factory(list))
|
|
13
|
+
teardown_steps = attrib(default=Factory(list))
|
|
14
|
+
teardown_step_results = attrib(default=Factory(list))
|
|
15
|
+
result_links = attrib(default=Factory(list))
|
|
16
|
+
duration = attrib(default=None)
|
|
17
|
+
outcome = attrib(default=None)
|
|
18
|
+
failure_reason_names = attrib(default=Factory(list))
|
|
19
|
+
traces = attrib(default=None)
|
|
20
|
+
attachments = attrib(default=Factory(list))
|
|
21
|
+
parameters = attrib(default=Factory(dict))
|
|
22
|
+
properties = attrib(default=Factory(dict))
|
|
23
|
+
namespace = attrib(default=None)
|
|
24
|
+
classname = attrib(default=None)
|
|
25
|
+
title = attrib(default=None)
|
|
26
|
+
description = attrib(default=None)
|
|
27
|
+
links = attrib(default=Factory(list))
|
|
28
|
+
labels = attrib(default=Factory(list))
|
|
29
|
+
work_item_ids = attrib(default=Factory(list))
|
|
30
|
+
message = attrib(default=None)
|
|
31
|
+
node_id = attrib(default=None)
|
|
@@ -19,6 +19,6 @@ class FixtureResult:
|
|
|
19
19
|
@attrs
|
|
20
20
|
class FixturesContainer:
|
|
21
21
|
uuid = attrib(default=None)
|
|
22
|
-
|
|
22
|
+
node_ids = attrib(default=Factory(list))
|
|
23
23
|
befores = attrib(default=Factory(list))
|
|
24
24
|
afters = attrib(default=Factory(list))
|
{testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/utils.py
RENAMED
|
@@ -11,54 +11,44 @@ from testit_python_commons.models.link import Link
|
|
|
11
11
|
from testit_python_commons.models.test_result import TestResult
|
|
12
12
|
from testit_python_commons.models.test_result_with_all_fixture_step_results_model import TestResultWithAllFixtureStepResults
|
|
13
13
|
|
|
14
|
+
from testit_adapter_pytest.models.executable_test import ExecutableTest
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
__ARRAY_TYPES = (frozenset, list, set, tuple,)
|
|
16
18
|
|
|
17
19
|
|
|
18
|
-
def form_test(item):
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'parameters': __get_parameters_from(item),
|
|
35
|
-
'properties': __get_properties_from(item),
|
|
36
|
-
'namespace': __get_namespace_from(item),
|
|
37
|
-
'classname': __get_class_name_from(item),
|
|
38
|
-
'title': __get_title_from(item),
|
|
39
|
-
'description': __get_description_from(item),
|
|
40
|
-
'links': __get_links_from(item),
|
|
41
|
-
'labels': __get_labels_from(item),
|
|
42
|
-
'workItemsID': __get_work_item_ids_from(item),
|
|
43
|
-
'message': None
|
|
44
|
-
}
|
|
20
|
+
def form_test(item) -> ExecutableTest:
|
|
21
|
+
executable_test = ExecutableTest(
|
|
22
|
+
external_id=__get_external_id_from(item),
|
|
23
|
+
name=__get_display_name_from(item),
|
|
24
|
+
duration=0,
|
|
25
|
+
parameters=__get_parameters_from(item),
|
|
26
|
+
properties=__get_properties_from(item),
|
|
27
|
+
namespace=__get_namespace_from(item),
|
|
28
|
+
classname=__get_class_name_from(item),
|
|
29
|
+
title=__get_title_from(item),
|
|
30
|
+
description=__get_description_from(item),
|
|
31
|
+
links=__get_links_from(item),
|
|
32
|
+
labels=__get_labels_from(item),
|
|
33
|
+
work_item_ids=__get_work_item_ids_from(item),
|
|
34
|
+
node_id=item.nodeid
|
|
35
|
+
)
|
|
45
36
|
|
|
46
37
|
if item.own_markers:
|
|
47
38
|
for mark in item.own_markers:
|
|
48
39
|
if mark.name == 'skip' or mark.name == 'skipif':
|
|
49
|
-
|
|
50
|
-
data['failureReasonName'] = None
|
|
40
|
+
executable_test.outcome = 'Skipped'
|
|
51
41
|
if mark.args:
|
|
52
|
-
|
|
42
|
+
executable_test.message = mark.args[0]
|
|
53
43
|
if mark.kwargs and 'reason' in mark.kwargs:
|
|
54
|
-
|
|
44
|
+
executable_test.message = mark.kwargs['reason']
|
|
55
45
|
if mark.name == 'xfail':
|
|
56
46
|
if mark.args:
|
|
57
|
-
|
|
47
|
+
executable_test.message = mark.args[0]
|
|
58
48
|
if mark.kwargs and 'reason' in mark.kwargs:
|
|
59
|
-
|
|
49
|
+
executable_test.message = mark.kwargs['reason']
|
|
60
50
|
|
|
61
|
-
return
|
|
51
|
+
return executable_test
|
|
62
52
|
|
|
63
53
|
|
|
64
54
|
def __get_display_name_from(item):
|
|
@@ -131,7 +121,7 @@ def __get_links_from(item):
|
|
|
131
121
|
|
|
132
122
|
|
|
133
123
|
def __get_parameters_from(item):
|
|
134
|
-
if hasattr(item, '
|
|
124
|
+
if hasattr(item, 'callspec'):
|
|
135
125
|
test_parameters = {}
|
|
136
126
|
for key, parameter in item.callspec.params.items():
|
|
137
127
|
test_parameters[key] = str(parameter)
|
|
@@ -299,28 +289,28 @@ def get_hash(value: str):
|
|
|
299
289
|
return md.hexdigest()
|
|
300
290
|
|
|
301
291
|
|
|
302
|
-
def convert_executable_test_to_test_result_model(executable_test:
|
|
292
|
+
def convert_executable_test_to_test_result_model(executable_test: ExecutableTest) -> TestResult:
|
|
303
293
|
return TestResult()\
|
|
304
|
-
.set_external_id(executable_test
|
|
305
|
-
.set_autotest_name(executable_test
|
|
306
|
-
.set_step_results(executable_test
|
|
307
|
-
.set_setup_results(executable_test
|
|
308
|
-
.set_teardown_results(executable_test
|
|
309
|
-
.set_duration(executable_test
|
|
310
|
-
.set_outcome(executable_test
|
|
311
|
-
.set_traces(executable_test
|
|
312
|
-
.set_attachments(executable_test
|
|
313
|
-
.set_parameters(executable_test
|
|
314
|
-
.set_properties(executable_test
|
|
315
|
-
.set_namespace(executable_test
|
|
316
|
-
.set_classname(executable_test
|
|
317
|
-
.set_title(executable_test
|
|
318
|
-
.set_description(executable_test
|
|
319
|
-
.set_links(executable_test
|
|
320
|
-
.set_result_links(executable_test
|
|
321
|
-
.set_labels(executable_test
|
|
322
|
-
.set_work_item_ids(executable_test
|
|
323
|
-
.set_message(executable_test
|
|
294
|
+
.set_external_id(executable_test.external_id)\
|
|
295
|
+
.set_autotest_name(executable_test.name)\
|
|
296
|
+
.set_step_results(executable_test.step_results)\
|
|
297
|
+
.set_setup_results(executable_test.setup_step_results)\
|
|
298
|
+
.set_teardown_results(executable_test.teardown_step_results)\
|
|
299
|
+
.set_duration(executable_test.duration)\
|
|
300
|
+
.set_outcome(executable_test.outcome)\
|
|
301
|
+
.set_traces(executable_test.traces)\
|
|
302
|
+
.set_attachments(executable_test.attachments)\
|
|
303
|
+
.set_parameters(executable_test.parameters)\
|
|
304
|
+
.set_properties(executable_test.properties)\
|
|
305
|
+
.set_namespace(executable_test.namespace)\
|
|
306
|
+
.set_classname(executable_test.classname)\
|
|
307
|
+
.set_title(executable_test.title)\
|
|
308
|
+
.set_description(executable_test.description)\
|
|
309
|
+
.set_links(executable_test.links)\
|
|
310
|
+
.set_result_links(executable_test.result_links)\
|
|
311
|
+
.set_labels(executable_test.labels)\
|
|
312
|
+
.set_work_item_ids(executable_test.work_item_ids)\
|
|
313
|
+
.set_message(executable_test.message)
|
|
324
314
|
|
|
325
315
|
|
|
326
316
|
def fixtures_containers_to_test_results_with_all_fixture_step_results(
|
|
@@ -328,11 +318,11 @@ def fixtures_containers_to_test_results_with_all_fixture_step_results(
|
|
|
328
318
|
test_result_ids: dict) -> typing.List[TestResultWithAllFixtureStepResults]:
|
|
329
319
|
test_results_with_all_fixture_step_results = []
|
|
330
320
|
|
|
331
|
-
for
|
|
321
|
+
for node_id, test_result_id in test_result_ids.items():
|
|
332
322
|
test_result_with_all_fixture_step_results = TestResultWithAllFixtureStepResults(test_result_id)
|
|
333
323
|
|
|
334
324
|
for uuid, fixtures_container in fixtures_containers.items():
|
|
335
|
-
if
|
|
325
|
+
if node_id in fixtures_container.node_ids:
|
|
336
326
|
if fixtures_container.befores:
|
|
337
327
|
test_result_with_all_fixture_step_results.set_setup_results(fixtures_container.befores[0].steps)
|
|
338
328
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: testit-adapter-pytest
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.2
|
|
4
4
|
Summary: Pytest adapter for Test IT
|
|
5
5
|
Home-page: https://github.com/testit-tms/adapters-python/
|
|
6
6
|
Author: Integration team
|
|
@@ -18,7 +18,7 @@ Description-Content-Type: text/markdown
|
|
|
18
18
|
Requires-Dist: pytest
|
|
19
19
|
Requires-Dist: pytest-xdist
|
|
20
20
|
Requires-Dist: attrs
|
|
21
|
-
Requires-Dist: testit-python-commons==3.0.
|
|
21
|
+
Requires-Dist: testit-python-commons==3.0.2
|
|
22
22
|
|
|
23
23
|
# Test IT TMS adapter for Pytest
|
|
24
24
|
|
|
@@ -14,4 +14,5 @@ src/testit_adapter_pytest.egg-info/entry_points.txt
|
|
|
14
14
|
src/testit_adapter_pytest.egg-info/requires.txt
|
|
15
15
|
src/testit_adapter_pytest.egg-info/top_level.txt
|
|
16
16
|
src/testit_adapter_pytest/models/__init__.py
|
|
17
|
+
src/testit_adapter_pytest/models/executable_test.py
|
|
17
18
|
src/testit_adapter_pytest/models/fixture.py
|
|
File without changes
|
|
File without changes
|
{testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{testit_adapter_pytest-3.0.1 → testit_adapter_pytest-3.0.2}/src/testit_adapter_pytest/plugin.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|