pytestomatio 2.8.2.dev42__tar.gz → 2.8.2.dev44__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.
- {pytestomatio-2.8.2.dev42/pytestomatio.egg-info → pytestomatio-2.8.2.dev44}/PKG-INFO +10 -4
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/README.md +3 -3
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pyproject.toml +5 -3
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/main.py +4 -1
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testing/testItem.py +48 -18
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testomatio/filter_plugin.py +14 -6
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44/pytestomatio.egg-info}/PKG-INFO +10 -4
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio.egg-info/SOURCES.txt +2 -1
- pytestomatio-2.8.2.dev44/pytestomatio.egg-info/requires.txt +13 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/test_cli_param_test_id.py +13 -13
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/test_cli_params.py +0 -1
- pytestomatio-2.8.2.dev44/tests/test_parameters.py +67 -0
- pytestomatio-2.8.2.dev42/tests/test_xdist.py → pytestomatio-2.8.2.dev44/tests/test_sync.py +3 -7
- pytestomatio-2.8.2.dev42/pytestomatio.egg-info/requires.txt +0 -6
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/LICENSE +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/__init__.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/connect/__init__.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/connect/connector.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/connect/s3_connector.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/decor/__init__.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/decor/decorator_updater.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/decor/default.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/decor/pep8.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testing/__init__.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testing/code_collector.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testomatio/__init__.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testomatio/testRunConfig.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testomatio/testomat_item.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testomatio/testomatio.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/utils/__init__.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/utils/helper.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/utils/parser_setup.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/utils/validations.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio.egg-info/dependency_links.txt +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio.egg-info/entry_points.txt +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio.egg-info/top_level.txt +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/setup.cfg +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/sub/__init__.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/sub/sub_mob/__init__.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/sub/sub_mob/sub_sub_class_test.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/sub/sub_mob/sub_sub_test.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/sub/test_class_sub.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/sub/test_sub.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/test_class_root.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/test_decorators.py +0 -0
- {pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/test_root.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytestomatio
|
|
3
|
-
Version: 2.8.2.
|
|
3
|
+
Version: 2.8.2.dev44
|
|
4
4
|
Summary: Pytest plugin to sync test with testomat.io
|
|
5
5
|
Author: Oleksii Ostapov, TikoQA
|
|
6
6
|
Project-URL: Testomat.io, https://testomat.io/
|
|
@@ -19,6 +19,12 @@ Requires-Dist: boto3>=1.28.28
|
|
|
19
19
|
Requires-Dist: libcst==1.1.0
|
|
20
20
|
Requires-Dist: commitizen>=3.18.1
|
|
21
21
|
Requires-Dist: autopep8>=2.1.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.2.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-testdox>=2.0.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-xdist==3.6.1; extra == "dev"
|
|
26
|
+
Requires-Dist: python-dotenv==1.0.1; extra == "dev"
|
|
27
|
+
Requires-Dist: toml==0.10.2; extra == "dev"
|
|
22
28
|
|
|
23
29
|
[](https://github.com/support-ukraine/support-ukraine)
|
|
24
30
|
|
|
@@ -226,9 +232,9 @@ def test_example():
|
|
|
226
232
|
## Contribution
|
|
227
233
|
Use python 3.12
|
|
228
234
|
|
|
229
|
-
1. `pip install ".[dev]"`
|
|
230
|
-
1. `
|
|
231
|
-
1. Test things manually
|
|
235
|
+
1. `pip install ".[dev]"`
|
|
236
|
+
1. `python ./smoke.py`
|
|
237
|
+
1. Test things manually
|
|
232
238
|
1. Verify no regression bugs
|
|
233
239
|
1. `cz commit`
|
|
234
240
|
1. `cz bump`
|
|
@@ -204,9 +204,9 @@ def test_example():
|
|
|
204
204
|
## Contribution
|
|
205
205
|
Use python 3.12
|
|
206
206
|
|
|
207
|
-
1. `pip install ".[dev]"`
|
|
208
|
-
1. `
|
|
209
|
-
1. Test things manually
|
|
207
|
+
1. `pip install ".[dev]"`
|
|
208
|
+
1. `python ./smoke.py`
|
|
209
|
+
1. Test things manually
|
|
210
210
|
1. Verify no regression bugs
|
|
211
211
|
1. `cz commit`
|
|
212
212
|
1. `cz bump`
|
|
@@ -13,7 +13,7 @@ version_provider = "pep621"
|
|
|
13
13
|
update_changelog_on_bump = false
|
|
14
14
|
[project]
|
|
15
15
|
name = "pytestomatio"
|
|
16
|
-
version = "2.8.2.
|
|
16
|
+
version = "2.8.2.dev44"
|
|
17
17
|
|
|
18
18
|
dependencies = [
|
|
19
19
|
"requests>=2.29.0",
|
|
@@ -46,11 +46,13 @@ classifiers = [
|
|
|
46
46
|
[project.entry-points.pytest11]
|
|
47
47
|
pytestomatio = "pytestomatio.main"
|
|
48
48
|
|
|
49
|
-
[
|
|
49
|
+
[project.optional-dependencies]
|
|
50
50
|
dev = [
|
|
51
51
|
"pytest>=7.2.0",
|
|
52
52
|
"pytest-testdox>=2.0.0",
|
|
53
|
-
"pytest-xdist==3.6.1"
|
|
53
|
+
"pytest-xdist==3.6.1",
|
|
54
|
+
"python-dotenv==1.0.1",
|
|
55
|
+
"toml==0.10.2"
|
|
54
56
|
]
|
|
55
57
|
|
|
56
58
|
[tool.pytest.ini_options]
|
|
@@ -14,6 +14,8 @@ from pytestomatio.testomatio.testRunConfig import TestRunConfig
|
|
|
14
14
|
from pytestomatio.testomatio.testomatio import Testomatio
|
|
15
15
|
from pytestomatio.testomatio.filter_plugin import TestomatioFilterPlugin
|
|
16
16
|
|
|
17
|
+
import pdb
|
|
18
|
+
|
|
17
19
|
log = logging.getLogger(__name__)
|
|
18
20
|
log.setLevel('INFO')
|
|
19
21
|
|
|
@@ -162,6 +164,7 @@ def pytest_runtest_makereport(item: Item, call: CallInfo):
|
|
|
162
164
|
'code': None,
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
# TODO: refactor it and use TestItem setter to upate those attributes
|
|
165
168
|
if call.when in ['setup', 'call']:
|
|
166
169
|
if call.excinfo is not None:
|
|
167
170
|
if call.excinfo.typename == 'Skipped':
|
|
@@ -175,7 +178,7 @@ def pytest_runtest_makereport(item: Item, call: CallInfo):
|
|
|
175
178
|
request['status'] = 'passed' if call.when == 'call' else request['status']
|
|
176
179
|
|
|
177
180
|
if hasattr(item, 'callspec'):
|
|
178
|
-
request['example'] = item.callspec.params
|
|
181
|
+
request['example'] = test_item.safe_params(item.callspec.params)
|
|
179
182
|
|
|
180
183
|
if item.nodeid not in pytest.testomatio.test_run_config.status_request:
|
|
181
184
|
pytest.testomatio.test_run_config.status_request[item.nodeid] = request
|
|
@@ -95,15 +95,34 @@ class TestItem:
|
|
|
95
95
|
else:
|
|
96
96
|
return name
|
|
97
97
|
|
|
98
|
-
def _get_test_parameter_key(self, item: Item)
|
|
99
|
-
|
|
98
|
+
def _get_test_parameter_key(self, item: Item):
|
|
99
|
+
"""Return a list of parameter names for a given test item."""
|
|
100
|
+
param_names = set()
|
|
101
|
+
|
|
102
|
+
# 1) Look for @pytest.mark.parametrize
|
|
100
103
|
for mark in item.iter_markers('parametrize'):
|
|
101
|
-
|
|
102
|
-
if
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
# mark.args[0] is often a string like "param1,param2"
|
|
105
|
+
# or just "param1" if there's only one.
|
|
106
|
+
if len(mark.args) > 0 and isinstance(mark.args[0], str):
|
|
107
|
+
arg_string = mark.args[0]
|
|
108
|
+
# If the string has commas, split it into multiple names
|
|
109
|
+
if ',' in arg_string:
|
|
110
|
+
param_names.update(name.strip() for name in arg_string.split(','))
|
|
111
|
+
else:
|
|
112
|
+
param_names.add(arg_string.strip())
|
|
113
|
+
|
|
114
|
+
# 2) Look for fixture parameterization (including dynamically generated)
|
|
115
|
+
# via callspec, which holds *all* final parameters for an item.
|
|
116
|
+
callspec = getattr(item, 'callspec', None)
|
|
117
|
+
if callspec:
|
|
118
|
+
# callspec.params is a dict: fixture_name -> parameter_value
|
|
119
|
+
# We only want fixture names, not the values.
|
|
120
|
+
param_names.update(callspec.params.keys())
|
|
121
|
+
|
|
122
|
+
print('_get_test_parameter_key ->', param_names)
|
|
123
|
+
# Return them as a list, or keep it as a set—whatever you prefer.
|
|
124
|
+
return list(param_names)
|
|
125
|
+
|
|
107
126
|
|
|
108
127
|
def _resolve_parameter_key_in_test_name(self, item: Item, test_name: str) -> str:
|
|
109
128
|
test_params = self._get_test_parameter_key(item)
|
|
@@ -120,25 +139,36 @@ class TestItem:
|
|
|
120
139
|
def _resolve_parameter_value_in_test_name(self, item: Item, test_name: str) -> str:
|
|
121
140
|
param_keys = self._get_test_parameter_key(item)
|
|
122
141
|
sync_title = self._get_sync_test_title(item)
|
|
142
|
+
|
|
123
143
|
if not param_keys:
|
|
124
144
|
return test_name
|
|
125
145
|
if not item.callspec:
|
|
126
146
|
return test_name
|
|
127
|
-
|
|
147
|
+
|
|
128
148
|
pattern = r'\$\{(.*?)\}'
|
|
129
149
|
|
|
130
150
|
def repl(match):
|
|
131
151
|
key = match.group(1)
|
|
132
|
-
|
|
133
152
|
value = item.callspec.params.get(key, '')
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
elif isinstance(value, (str, int, float, bool)):
|
|
137
|
-
string_value = str(value)
|
|
138
|
-
else:
|
|
139
|
-
string_value = 'Unsupported type'
|
|
153
|
+
|
|
154
|
+
string_value = self._to_string_value(value)
|
|
140
155
|
# TODO: handle "value with space" on testomatio BE https://github.com/testomatio/check-tests/issues/147
|
|
141
|
-
return sub(r"[\.\s]", "_", string_value)
|
|
156
|
+
return sub(r"[\.\s]", "_", string_value) # Temporary fix for spaces in parameter values
|
|
142
157
|
|
|
143
158
|
test_name = sub(pattern, repl, sync_title)
|
|
144
|
-
return test_name
|
|
159
|
+
return test_name
|
|
160
|
+
|
|
161
|
+
def _to_string_value(self, value):
|
|
162
|
+
if callable(value):
|
|
163
|
+
return value.__name__ if hasattr(value, "__name__") else "anonymous_function"
|
|
164
|
+
elif isinstance(value, bytes):
|
|
165
|
+
return value.decode('utf-8')
|
|
166
|
+
elif isinstance(value, (str, int, float, bool)) or value is None:
|
|
167
|
+
return str(value)
|
|
168
|
+
else:
|
|
169
|
+
return str(value) # Fallback to a string representation
|
|
170
|
+
|
|
171
|
+
# TODO: leverage as an attribute setter
|
|
172
|
+
def safe_params(self, params):
|
|
173
|
+
return {key: self._to_string_value(value) for key, value in params.items()}
|
|
174
|
+
|
{pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testomatio/filter_plugin.py
RENAMED
|
@@ -5,7 +5,6 @@ class TestomatioFilterPlugin:
|
|
|
5
5
|
def pytest_collection_modifyitems(self, session, config, items):
|
|
6
6
|
# By now all other filters (like -m, -k, name-based) have been applied
|
|
7
7
|
# and `items` is the filtered set after all their conditions.
|
|
8
|
-
|
|
9
8
|
test_ids_str = config.getoption("test_id")
|
|
10
9
|
if not test_ids_str:
|
|
11
10
|
# No custom IDs specified, nothing to do
|
|
@@ -31,8 +30,9 @@ class TestomatioFilterPlugin:
|
|
|
31
30
|
testomatio_matched.append(item)
|
|
32
31
|
break
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
# We'll check common filters: -k, -m and a few others.
|
|
35
34
|
# If they are empty or None, they are not active.
|
|
35
|
+
|
|
36
36
|
other_filters_active = bool(
|
|
37
37
|
config.option.keyword or # -k
|
|
38
38
|
config.option.markexpr or # -m
|
|
@@ -42,12 +42,20 @@ class TestomatioFilterPlugin:
|
|
|
42
42
|
False
|
|
43
43
|
)
|
|
44
44
|
|
|
45
|
+
if other_filters_active and "not" in config.option.keyword:
|
|
46
|
+
# If a "not" keyword filter exist - it means we have exclusion filter applied.
|
|
47
|
+
# In such scenario we respect the exclusion filters in a way
|
|
48
|
+
# that we accept tests with requested test ids as long as such tests do not fall into exclusion filter
|
|
49
|
+
items[:] = [item for item in testomatio_matched if item in items]
|
|
50
|
+
return
|
|
51
|
+
|
|
45
52
|
if other_filters_active:
|
|
46
53
|
# If other filters are applied, use OR logic:
|
|
47
54
|
# the final set is all items that passed previous filters plus those matched by test-ids
|
|
48
55
|
# preserving original order of test
|
|
49
56
|
items[:] = items + [item for item in testomatio_matched if item not in items]
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
return
|
|
58
|
+
|
|
59
|
+
# If no other filters are applied, test-ids filter acts as an exclusive filter:
|
|
60
|
+
# only run tests that match the given test IDs
|
|
61
|
+
items[:] = testomatio_matched
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytestomatio
|
|
3
|
-
Version: 2.8.2.
|
|
3
|
+
Version: 2.8.2.dev44
|
|
4
4
|
Summary: Pytest plugin to sync test with testomat.io
|
|
5
5
|
Author: Oleksii Ostapov, TikoQA
|
|
6
6
|
Project-URL: Testomat.io, https://testomat.io/
|
|
@@ -19,6 +19,12 @@ Requires-Dist: boto3>=1.28.28
|
|
|
19
19
|
Requires-Dist: libcst==1.1.0
|
|
20
20
|
Requires-Dist: commitizen>=3.18.1
|
|
21
21
|
Requires-Dist: autopep8>=2.1.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.2.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-testdox>=2.0.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-xdist==3.6.1; extra == "dev"
|
|
26
|
+
Requires-Dist: python-dotenv==1.0.1; extra == "dev"
|
|
27
|
+
Requires-Dist: toml==0.10.2; extra == "dev"
|
|
22
28
|
|
|
23
29
|
[](https://github.com/support-ukraine/support-ukraine)
|
|
24
30
|
|
|
@@ -226,9 +232,9 @@ def test_example():
|
|
|
226
232
|
## Contribution
|
|
227
233
|
Use python 3.12
|
|
228
234
|
|
|
229
|
-
1. `pip install ".[dev]"`
|
|
230
|
-
1. `
|
|
231
|
-
1. Test things manually
|
|
235
|
+
1. `pip install ".[dev]"`
|
|
236
|
+
1. `python ./smoke.py`
|
|
237
|
+
1. Test things manually
|
|
232
238
|
1. Verify no regression bugs
|
|
233
239
|
1. `cz commit`
|
|
234
240
|
1. `cz bump`
|
|
@@ -32,8 +32,9 @@ tests/test_class_root.py
|
|
|
32
32
|
tests/test_cli_param_test_id.py
|
|
33
33
|
tests/test_cli_params.py
|
|
34
34
|
tests/test_decorators.py
|
|
35
|
+
tests/test_parameters.py
|
|
35
36
|
tests/test_root.py
|
|
36
|
-
tests/
|
|
37
|
+
tests/test_sync.py
|
|
37
38
|
tests/sub/__init__.py
|
|
38
39
|
tests/sub/test_class_sub.py
|
|
39
40
|
tests/sub/test_sub.py
|
|
@@ -23,46 +23,46 @@ test_file = """
|
|
|
23
23
|
def test_cli_param_test_id_without_filters(pytester):
|
|
24
24
|
pytester.makepyfile(test_file)
|
|
25
25
|
|
|
26
|
-
result = pytester.
|
|
26
|
+
result = pytester.runpytest_subprocess("--testomatio", "report", "-vv")
|
|
27
27
|
result.assert_outcomes(passed=4, failed=0, skipped=0)
|
|
28
28
|
result.stdout.fnmatch_lines([
|
|
29
|
-
"*::test_smoke
|
|
30
|
-
"*::test_testomatio_only
|
|
31
|
-
"*::test_smoke_and_testomatio
|
|
32
|
-
"*::test_neither_marker
|
|
29
|
+
"*::test_smoke*",
|
|
30
|
+
"*::test_testomatio_only*",
|
|
31
|
+
"*::test_smoke_and_testomatio*",
|
|
32
|
+
"*::test_neither_marker*",
|
|
33
33
|
])
|
|
34
34
|
|
|
35
35
|
@pytest.mark.testomatio("@T3cf626ca")
|
|
36
36
|
def test_cli_param_test_id_with_k_filter(pytester):
|
|
37
37
|
pytester.makepyfile(test_file)
|
|
38
38
|
|
|
39
|
-
result = pytester.
|
|
39
|
+
result = pytester.runpytest_subprocess("--testomatio" ,"report", "-vv", "-k", "test_neither_marker")
|
|
40
40
|
result.assert_outcomes(passed=1, failed=0, skipped=0)
|
|
41
41
|
result.stdout.fnmatch_lines([
|
|
42
|
-
"*::test_neither_marker
|
|
42
|
+
"*::test_neither_marker*",
|
|
43
43
|
])
|
|
44
44
|
|
|
45
45
|
@pytest.mark.testomatio("@T709adc8a")
|
|
46
46
|
def test_cli_param_test_id_without_k_filter_matching_2_tests(pytester):
|
|
47
47
|
pytester.makepyfile(test_file)
|
|
48
48
|
|
|
49
|
-
result = pytester.
|
|
49
|
+
result = pytester.runpytest_subprocess("--testomatio", "report", "-vv", "-k", "test_smoke")
|
|
50
50
|
result.assert_outcomes(passed=2, failed=0, skipped=0)
|
|
51
51
|
result.stdout.fnmatch_lines([
|
|
52
|
-
"*::test_smoke
|
|
53
|
-
"*::test_smoke_and_testomatio
|
|
52
|
+
"*::test_smoke*",
|
|
53
|
+
"*::test_smoke_and_testomatio*",
|
|
54
54
|
])
|
|
55
55
|
|
|
56
56
|
# TODO: troubleshoot pytester env
|
|
57
57
|
# The testomatio and test-id parameters are lost in the pytester env.
|
|
58
58
|
# Please test it in a semiautomated way with "test_cli_params.py" test
|
|
59
59
|
@pytest.mark.testomatio("@T5a965adf")
|
|
60
|
-
@pytest.mark.skip
|
|
61
60
|
def test_cli_param_test_id_with_test_id_filter(pytester):
|
|
61
|
+
pytest.skip()
|
|
62
62
|
pytester.makepyfile(test_file)
|
|
63
63
|
|
|
64
|
-
result = pytester.
|
|
64
|
+
result = pytester.runpytest_subprocess("--testomatio", "report", '--test-id="@T123"', "-vv")
|
|
65
65
|
result.assert_outcomes(passed=1, failed=0, skipped=0)
|
|
66
66
|
result.stdout.fnmatch_lines([
|
|
67
|
-
"*::test_testomatio_only
|
|
67
|
+
"*::test_testomatio_only*",
|
|
68
68
|
])
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
pytestmark = pytest.mark.smoke
|
|
3
|
+
|
|
4
|
+
test_file = """
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
# Define some dummy callables
|
|
8
|
+
def add(a, b):
|
|
9
|
+
return a + b
|
|
10
|
+
|
|
11
|
+
def multiply(a, b):
|
|
12
|
+
return a * b
|
|
13
|
+
|
|
14
|
+
@pytest.mark.testomatio("@Tbca18714")
|
|
15
|
+
@pytest.mark.parametrize(
|
|
16
|
+
"operation, a, b, expected",
|
|
17
|
+
[
|
|
18
|
+
(add, 2, 3, 5), # Test add function
|
|
19
|
+
(multiply, 2, 3, 6), # Test multiply function
|
|
20
|
+
],
|
|
21
|
+
)
|
|
22
|
+
def test_operations(operation, a, b, expected):
|
|
23
|
+
# Call the provided operation
|
|
24
|
+
result = operation(a, b)
|
|
25
|
+
assert result == expected, f"Expected {expected}, got {result}"
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
@pytest.mark.testomatio("@Tb8930394")
|
|
29
|
+
def test_callable_in_params(pytester):
|
|
30
|
+
pytester.makepyfile(test_file)
|
|
31
|
+
|
|
32
|
+
pytester.runpytest("--testomatio", "sync", "-n", "0", "--no-detach")
|
|
33
|
+
result = pytester.runpytest("--testomatio", "report", "-vv")
|
|
34
|
+
result.assert_outcomes(passed=2, failed=0, skipped=0)
|
|
35
|
+
cleaned_lines = [line.strip() for line in result.stdout.lines if line.strip()]
|
|
36
|
+
|
|
37
|
+
assert any("test_callable_in_params.py::test_operations[add-2-3-5]" in line for line in cleaned_lines)
|
|
38
|
+
assert any("test_callable_in_params.py::test_operations[multiply-2-3-6]" in line for line in cleaned_lines)
|
|
39
|
+
|
|
40
|
+
session_fixture_file = """
|
|
41
|
+
import pytest
|
|
42
|
+
|
|
43
|
+
@pytest.fixture(scope="session", params=["db_connection_1", "db_connection_2"])
|
|
44
|
+
def session_fixture(request):
|
|
45
|
+
# Simulate setting up a database connection
|
|
46
|
+
db_connection = request.param
|
|
47
|
+
yield db_connection
|
|
48
|
+
# Simulate tearing down the database connection
|
|
49
|
+
|
|
50
|
+
def test_session_fixture_usage(session_fixture):
|
|
51
|
+
assert session_fixture in ["db_connection_1", "db_connection_2"], (
|
|
52
|
+
f"Unexpected session fixture value: {session_fixture}"
|
|
53
|
+
)
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
def test_session_fixture_with_param(pytester):
|
|
57
|
+
pytester.makepyfile(session_fixture_file)
|
|
58
|
+
|
|
59
|
+
pytester.runpytest("--testomatio", "sync", "-n", "0", "--no-detach")
|
|
60
|
+
result = pytester.runpytest("--testomatio", "report", "-vv", "--full-trace")
|
|
61
|
+
result.assert_outcomes(passed=2, failed=0, skipped=0)
|
|
62
|
+
|
|
63
|
+
cleaned_lines = [line.strip() for line in result.stdout.lines if line.strip()]
|
|
64
|
+
|
|
65
|
+
assert any("test_session_fixture_usage[db_connection_1]" in line for line in cleaned_lines)
|
|
66
|
+
assert any("test_session_fixture_usage[db_connection_2]" in line for line in cleaned_lines)
|
|
67
|
+
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import pytest
|
|
2
|
+
#TODO verify requests to testomatio
|
|
2
3
|
|
|
3
4
|
@pytest.mark.testomatio("@Tfaf4da53")
|
|
4
5
|
@pytest.mark.smoke
|
|
@@ -13,7 +14,7 @@ def test_sync_stop_when_xdist_in_use(pytester):
|
|
|
13
14
|
# if option == 'sync' and parallel_set:
|
|
14
15
|
# raise UsageError("The 'sync' mode does not support parallel execution! In order to synchronise test run command sync as '--testomatio sync -n 0'")
|
|
15
16
|
|
|
16
|
-
result = pytester.
|
|
17
|
+
result = pytester.runpytest('-p', 'xdist', '--testomatio', 'sync', '-vv')
|
|
17
18
|
|
|
18
19
|
# Match the entire error line as it appears in stderr
|
|
19
20
|
result.stderr.fnmatch_lines([
|
|
@@ -30,17 +31,12 @@ def test_sync_works_with_xdist_set_to_0(pytester):
|
|
|
30
31
|
assert True
|
|
31
32
|
""")
|
|
32
33
|
|
|
33
|
-
result = pytester.
|
|
34
|
+
result = pytester.runpytest_subprocess('-p', 'xdist', '--testomatio', 'sync', '-n', '0', '-vv')
|
|
34
35
|
|
|
35
36
|
# Assert that the special exit message is printed to stderr
|
|
36
37
|
result.stdout.fnmatch_lines([
|
|
37
38
|
"*Sync completed without test execution*"
|
|
38
39
|
])
|
|
39
40
|
|
|
40
|
-
# Assert that no tests were run
|
|
41
|
-
result.stdout.fnmatch_lines([
|
|
42
|
-
"*no tests ran in *"
|
|
43
|
-
])
|
|
44
|
-
|
|
45
41
|
# Optional: Verify the process exited successfully (0 means no error)
|
|
46
42
|
assert result.ret == 2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/decor/decorator_updater.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testing/code_collector.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testomatio/testRunConfig.py
RENAMED
|
File without changes
|
{pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio/testomatio/testomat_item.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/pytestomatio.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytestomatio-2.8.2.dev42 → pytestomatio-2.8.2.dev44}/tests/sub/sub_mob/sub_sub_class_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|