testit-adapter-pytest 3.3.1__tar.gz → 3.3.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.
Files changed (21) hide show
  1. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/PKG-INFO +17 -2
  2. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/README.md +15 -0
  3. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/setup.py +2 -2
  4. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/utils.py +31 -2
  5. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest.egg-info/PKG-INFO +17 -2
  6. testit_adapter_pytest-3.3.2/src/testit_adapter_pytest.egg-info/requires.txt +4 -0
  7. testit_adapter_pytest-3.3.1/src/testit_adapter_pytest.egg-info/requires.txt +0 -4
  8. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/setup.cfg +0 -0
  9. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/__init__.py +0 -0
  10. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/fixture_context.py +0 -0
  11. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/fixture_manager.py +0 -0
  12. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/fixture_storage.py +0 -0
  13. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/listener.py +0 -0
  14. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/models/__init__.py +0 -0
  15. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/models/executable_test.py +0 -0
  16. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/models/fixture.py +0 -0
  17. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest/plugin.py +0 -0
  18. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest.egg-info/SOURCES.txt +0 -0
  19. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest.egg-info/dependency_links.txt +0 -0
  20. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.2}/src/testit_adapter_pytest.egg-info/entry_points.txt +0 -0
  21. {testit_adapter_pytest-3.3.1 → testit_adapter_pytest-3.3.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.3.1
3
+ Version: 3.3.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
@@ -16,7 +16,7 @@ Description-Content-Type: text/markdown
16
16
  Requires-Dist: pytest
17
17
  Requires-Dist: pytest-xdist
18
18
  Requires-Dist: attrs
19
- Requires-Dist: testit-python-commons==3.3.1
19
+ Requires-Dist: testit-python-commons==3.3.2
20
20
 
21
21
  # Test IT TMS adapter for Pytest
22
22
 
@@ -92,6 +92,21 @@ $ pytest --testit --tmsUrl=URL --tmsPrivateToken=USER_PRIVATE_TOKEN --tmsProject
92
92
  If you want to enable debug mode then
93
93
  see [How to enable debug logging?](https://github.com/testit-tms/adapters-python/tree/main/testit-python-commons)
94
94
 
95
+ #### Run with filter
96
+ To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):
97
+
98
+ ```
99
+ $ export TMS_TOKEN=<YOUR_TOKEN>
100
+ $ testit autotests_filter
101
+ --url https://tms.testit.software \
102
+ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
103
+ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
104
+ --framework pytest \
105
+ --output tmp/filter.txt
106
+
107
+ $ pytest "$(cat tmp/filter.txt)" --tmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 --tmsAdapterMode=1 --testit
108
+ ```
109
+
95
110
  ### Decorators
96
111
 
97
112
  Decorators can be used to specify information about autotest.
@@ -72,6 +72,21 @@ $ pytest --testit --tmsUrl=URL --tmsPrivateToken=USER_PRIVATE_TOKEN --tmsProject
72
72
  If you want to enable debug mode then
73
73
  see [How to enable debug logging?](https://github.com/testit-tms/adapters-python/tree/main/testit-python-commons)
74
74
 
75
+ #### Run with filter
76
+ To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):
77
+
78
+ ```
79
+ $ export TMS_TOKEN=<YOUR_TOKEN>
80
+ $ testit autotests_filter
81
+ --url https://tms.testit.software \
82
+ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
83
+ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
84
+ --framework pytest \
85
+ --output tmp/filter.txt
86
+
87
+ $ pytest "$(cat tmp/filter.txt)" --tmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 --tmsAdapterMode=1 --testit
88
+ ```
89
+
75
90
  ### Decorators
76
91
 
77
92
  Decorators can be used to specify information about autotest.
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name='testit-adapter-pytest',
5
- version='3.3.1',
5
+ version='3.3.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",
@@ -21,6 +21,6 @@ setup(
21
21
  py_modules=['testit_adapter_pytest'],
22
22
  packages=find_packages(where='src'),
23
23
  package_dir={'': 'src'},
24
- install_requires=['pytest', 'pytest-xdist', 'attrs', 'testit-python-commons==3.3.1'],
24
+ install_requires=['pytest', 'pytest-xdist', 'attrs', 'testit-python-commons==3.3.2'],
25
25
  entry_points={'pytest11': ['testit_adapter_pytest = testit_adapter_pytest.plugin']}
26
26
  )
@@ -295,6 +295,8 @@ def get_hash(value: str):
295
295
 
296
296
 
297
297
  def convert_executable_test_to_test_result_model(executable_test: ExecutableTest) -> TestResult:
298
+ pytest_autotest_keys = convert_node_id_to_pytest_autotest_keys(executable_test.node_id)
299
+
298
300
  return TestResult()\
299
301
  .set_external_id(executable_test.external_id)\
300
302
  .set_autotest_name(executable_test.name)\
@@ -314,8 +316,35 @@ def convert_executable_test_to_test_result_model(executable_test: ExecutableTest
314
316
  .set_links(executable_test.links)\
315
317
  .set_result_links(executable_test.result_links)\
316
318
  .set_labels(executable_test.labels)\
317
- .set_work_item_ids(executable_test.work_item_ids)\
318
- .set_message(executable_test.message)
319
+ .set_work_item_ids(executable_test.work_item_ids) \
320
+ .set_message(executable_test.message) \
321
+ .set_external_key(pytest_autotest_keys)
322
+
323
+
324
+ def convert_node_id_to_pytest_autotest_keys(node_id: str) -> str:
325
+ test_path_parts = __get_test_path_parts_by_node_id(node_id)
326
+ directories_in_project = __get_directories_in_project_by_test_path_parts(test_path_parts)
327
+ test_node_parts_from_module = __get_test_node_parts_from_module_by_test_path_parts(test_path_parts)
328
+
329
+ return __join_test_node_parts_to_pytest_autotest_keys(directories_in_project + test_node_parts_from_module)
330
+
331
+
332
+ def __get_test_path_parts_by_node_id(node_id: str):
333
+ return node_id.split('/')
334
+
335
+
336
+ def __get_directories_in_project_by_test_path_parts(test_path_parts: typing.List[str]):
337
+ return test_path_parts[:-1]
338
+
339
+
340
+ def __get_test_node_parts_from_module_by_test_path_parts(test_path_parts: typing.List[str]):
341
+ test_node_from_module = test_path_parts[-1]
342
+
343
+ return test_node_from_module.split('::')
344
+
345
+
346
+ def __join_test_node_parts_to_pytest_autotest_keys(test_node_parts: typing.List[str]):
347
+ return ' and '.join(test_node_parts)
319
348
 
320
349
 
321
350
  def fixtures_containers_to_test_results_with_all_fixture_step_results(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: testit-adapter-pytest
3
- Version: 3.3.1
3
+ Version: 3.3.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
@@ -16,7 +16,7 @@ Description-Content-Type: text/markdown
16
16
  Requires-Dist: pytest
17
17
  Requires-Dist: pytest-xdist
18
18
  Requires-Dist: attrs
19
- Requires-Dist: testit-python-commons==3.3.1
19
+ Requires-Dist: testit-python-commons==3.3.2
20
20
 
21
21
  # Test IT TMS adapter for Pytest
22
22
 
@@ -92,6 +92,21 @@ $ pytest --testit --tmsUrl=URL --tmsPrivateToken=USER_PRIVATE_TOKEN --tmsProject
92
92
  If you want to enable debug mode then
93
93
  see [How to enable debug logging?](https://github.com/testit-tms/adapters-python/tree/main/testit-python-commons)
94
94
 
95
+ #### Run with filter
96
+ To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):
97
+
98
+ ```
99
+ $ export TMS_TOKEN=<YOUR_TOKEN>
100
+ $ testit autotests_filter
101
+ --url https://tms.testit.software \
102
+ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
103
+ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
104
+ --framework pytest \
105
+ --output tmp/filter.txt
106
+
107
+ $ pytest "$(cat tmp/filter.txt)" --tmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 --tmsAdapterMode=1 --testit
108
+ ```
109
+
95
110
  ### Decorators
96
111
 
97
112
  Decorators can be used to specify information about autotest.
@@ -0,0 +1,4 @@
1
+ pytest
2
+ pytest-xdist
3
+ attrs
4
+ testit-python-commons==3.3.2
@@ -1,4 +0,0 @@
1
- pytest
2
- pytest-xdist
3
- attrs
4
- testit-python-commons==3.3.1