pytest-plugins 0.3.4__tar.gz → 0.3.6__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.
- {pytest_plugins-0.3.4/pytest_plugins.egg-info → pytest_plugins-0.3.6}/PKG-INFO +4 -1
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/README.md +3 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/better_report.py +25 -15
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/models/execution_data.py +7 -2
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/utils/helper.py +2 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/utils/pytest_helper.py +14 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6/pytest_plugins.egg-info}/PKG-INFO +4 -1
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/setup.py +1 -1
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/LICENSE +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/MANIFEST.in +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pyproject.toml +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/__init__.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/add_config_parameters.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/fail2skip.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/max_fail_streak.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/models/__init__.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/models/base_class_test.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/models/environment_data.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/models/status.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/models/test_data.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/utils/__init__.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/utils/create_report.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins/verbose_param_ids.py +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins.egg-info/SOURCES.txt +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins.egg-info/dependency_links.txt +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins.egg-info/entry_points.txt +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins.egg-info/requires.txt +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/pytest_plugins.egg-info/top_level.txt +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/requirements.txt +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/setup.cfg +0 -0
- {pytest_plugins-0.3.4 → pytest_plugins-0.3.6}/tests/test_dummy.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-plugins
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: A Python package for managing pytest plugins.
|
|
5
5
|
Home-page: https://github.com/aviz92/pytest-plugins
|
|
6
6
|
Author: Avi Zaguri
|
|
@@ -43,8 +43,11 @@ generate `execution_results.json`, `test_results.json`, and `test_report`.md und
|
|
|
43
43
|
- `--output-dir`: Specify the output directory for the report files (default is `root_project/results_output/`).
|
|
44
44
|
- `--traceback`: Include detailed traceback information in the report.
|
|
45
45
|
- `--md-report`: Generate a Markdown report of the test results.
|
|
46
|
+
- `repo-name`: Specify the git repository name for the report.
|
|
46
47
|
- `--pr-number`: Include a pull request number in the report for better traceability.
|
|
47
48
|
- `--mr-number`: Include a merge request number in the report for better traceability.
|
|
49
|
+
- `--pipeline-number`: Include a CI pipeline number in the report for better traceability.
|
|
50
|
+
- `--commit`: Include the commit hash in the report for better traceability.
|
|
48
51
|
- `--add-parameters`: Add the test parameters as fields to the test results.
|
|
49
52
|
- `--pytest-command`: Add the detailed information about the pytest command-line to the "execution_results.json" file
|
|
50
53
|
<br> <br>
|
|
@@ -12,8 +12,11 @@ generate `execution_results.json`, `test_results.json`, and `test_report`.md und
|
|
|
12
12
|
- `--output-dir`: Specify the output directory for the report files (default is `root_project/results_output/`).
|
|
13
13
|
- `--traceback`: Include detailed traceback information in the report.
|
|
14
14
|
- `--md-report`: Generate a Markdown report of the test results.
|
|
15
|
+
- `repo-name`: Specify the git repository name for the report.
|
|
15
16
|
- `--pr-number`: Include a pull request number in the report for better traceability.
|
|
16
17
|
- `--mr-number`: Include a merge request number in the report for better traceability.
|
|
18
|
+
- `--pipeline-number`: Include a CI pipeline number in the report for better traceability.
|
|
19
|
+
- `--commit`: Include the commit hash in the report for better traceability.
|
|
17
20
|
- `--add-parameters`: Add the test parameters as fields to the test results.
|
|
18
21
|
- `--pytest-command`: Add the detailed information about the pytest command-line to the "execution_results.json" file
|
|
19
22
|
<br> <br>
|
|
@@ -20,7 +20,7 @@ from pytest_plugins.utils.pytest_helper import (
|
|
|
20
20
|
get_test_full_name,
|
|
21
21
|
get_test_name_without_parameters,
|
|
22
22
|
get_test_full_path,
|
|
23
|
-
get_pytest_test_name
|
|
23
|
+
get_pytest_test_name, log_test_results
|
|
24
24
|
)
|
|
25
25
|
from pytest_plugins.utils.create_report import generate_md_report
|
|
26
26
|
|
|
@@ -56,6 +56,12 @@ def pytest_addoption(parser: Parser) -> None:
|
|
|
56
56
|
default=False,
|
|
57
57
|
help="Generate a markdown report of the test results"
|
|
58
58
|
)
|
|
59
|
+
parser.addoption(
|
|
60
|
+
"--repo-name",
|
|
61
|
+
action="store",
|
|
62
|
+
default=None,
|
|
63
|
+
help="Git Repository Name"
|
|
64
|
+
)
|
|
59
65
|
parser.addoption(
|
|
60
66
|
"--pr-number",
|
|
61
67
|
action="store",
|
|
@@ -68,6 +74,18 @@ def pytest_addoption(parser: Parser) -> None:
|
|
|
68
74
|
default=None,
|
|
69
75
|
help="Merge Request Number"
|
|
70
76
|
)
|
|
77
|
+
parser.addoption(
|
|
78
|
+
"--pipeline-number",
|
|
79
|
+
action="store",
|
|
80
|
+
default=None,
|
|
81
|
+
help="CI Pipeline Number"
|
|
82
|
+
)
|
|
83
|
+
parser.addoption(
|
|
84
|
+
"--commit",
|
|
85
|
+
action="store",
|
|
86
|
+
default=None,
|
|
87
|
+
help="Commit Hash (SHA-1) of the repository at the time of test execution"
|
|
88
|
+
)
|
|
71
89
|
parser.addoption(
|
|
72
90
|
"--add-parameters",
|
|
73
91
|
action="store_true",
|
|
@@ -108,9 +126,12 @@ def pytest_sessionstart(session: Session) -> None:
|
|
|
108
126
|
execution_results["execution_info"] = ExecutionData(
|
|
109
127
|
execution_status=ExecutionStatus.STARTED,
|
|
110
128
|
revision=datetime.now(timezone.utc).strftime("%Y%m%d%H%M%S%f"),
|
|
129
|
+
execution_start_time=datetime.now(timezone.utc).isoformat(),
|
|
130
|
+
repo_name=session.config.getoption("--repo-name", None),
|
|
111
131
|
pull_request_number=session.config.getoption("--pr-number", None),
|
|
112
132
|
merge_request_number=session.config.getoption("--mr-number", None),
|
|
113
|
-
|
|
133
|
+
pipeline_number=session.config.getoption("--pipeline-number", None),
|
|
134
|
+
commit=session.config.getoption("--commit", None),
|
|
114
135
|
)
|
|
115
136
|
|
|
116
137
|
if session.config.getoption("--pytest-command"):
|
|
@@ -190,19 +211,6 @@ def session_setup_teardown(request: FixtureRequest) -> Generator[None, Any, None
|
|
|
190
211
|
logger.info("Better report: Execution results saved")
|
|
191
212
|
|
|
192
213
|
|
|
193
|
-
@pytest.fixture(autouse=True)
|
|
194
|
-
def log_test_results(request: FixtureRequest) -> None:
|
|
195
|
-
if not getattr(request.config, '_better_report_enabled', None):
|
|
196
|
-
return
|
|
197
|
-
|
|
198
|
-
test_item = request.node
|
|
199
|
-
test_full_name = get_test_full_name(item=test_item)
|
|
200
|
-
if test_full_name in test_results:
|
|
201
|
-
logger.debug(f'Test Results: \n{json.dumps(test_results[test_full_name], indent=4, default=serialize_data)}')
|
|
202
|
-
else:
|
|
203
|
-
logger.warning(f"Test {test_full_name} missing in test_results during report")
|
|
204
|
-
|
|
205
|
-
|
|
206
214
|
def pytest_runtest_teardown(item: Function) -> None:
|
|
207
215
|
if not getattr(item.config, '_better_report_enabled', None):
|
|
208
216
|
return
|
|
@@ -262,6 +270,8 @@ def pytest_runtest_makereport(item: Function, call: Any) -> Generator[None, Any,
|
|
|
262
270
|
else:
|
|
263
271
|
test_item.exception_message = None
|
|
264
272
|
|
|
273
|
+
log_test_results(item=item, test_results=test_results)
|
|
274
|
+
|
|
265
275
|
|
|
266
276
|
def pytest_sessionfinish(session: Session) -> None:
|
|
267
277
|
if session.config.getoption("--collect-only") or not getattr(session.config, '_better_report_enabled', None):
|
|
@@ -8,9 +8,14 @@ from pytest_plugins.models.status import ExecutionStatus
|
|
|
8
8
|
class ExecutionData:
|
|
9
9
|
execution_status: ExecutionStatus
|
|
10
10
|
revision: Optional[str]
|
|
11
|
-
pull_request_number: Optional[str]
|
|
12
|
-
merge_request_number: Optional[str]
|
|
13
11
|
execution_start_time: Optional[str] = None
|
|
14
12
|
execution_end_time: Optional[str] = None
|
|
15
13
|
execution_duration_sec: Optional[str] = None
|
|
14
|
+
|
|
15
|
+
repo_name: Optional[str] = None
|
|
16
|
+
pull_request_number: Optional[str] = None
|
|
17
|
+
merge_request_number: Optional[str] = None
|
|
18
|
+
pipeline_number: Optional[str] = None
|
|
19
|
+
commit: Optional[str] = None
|
|
20
|
+
|
|
16
21
|
test_list: Optional[list] = None
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import logging
|
|
2
3
|
|
|
3
4
|
from _pytest.python import Function
|
|
4
5
|
|
|
6
|
+
from pytest_plugins.utils.helper import serialize_data
|
|
7
|
+
|
|
5
8
|
logger = logging.getLogger()
|
|
6
9
|
|
|
7
10
|
|
|
@@ -30,3 +33,14 @@ def get_test_full_path(item: Function) -> str:
|
|
|
30
33
|
"""Get the full name of the test, including parameters if available."""
|
|
31
34
|
test_name = get_test_path_without_parameters(item=item)
|
|
32
35
|
return f"{test_name}[{item.callspec.params}]" if getattr(item, 'callspec', None) else test_name
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def log_test_results(item: Function, test_results: dict) -> None:
|
|
39
|
+
if not getattr(item.config, '_better_report_enabled', None):
|
|
40
|
+
return
|
|
41
|
+
|
|
42
|
+
test_full_name = get_test_full_name(item=item)
|
|
43
|
+
if test_full_name in test_results:
|
|
44
|
+
logger.debug(f'Test Results: \n{json.dumps(test_results[test_full_name], indent=4, default=serialize_data)}')
|
|
45
|
+
else:
|
|
46
|
+
logger.warning(f"Test {test_full_name} missing in test_results during report")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-plugins
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary: A Python package for managing pytest plugins.
|
|
5
5
|
Home-page: https://github.com/aviz92/pytest-plugins
|
|
6
6
|
Author: Avi Zaguri
|
|
@@ -43,8 +43,11 @@ generate `execution_results.json`, `test_results.json`, and `test_report`.md und
|
|
|
43
43
|
- `--output-dir`: Specify the output directory for the report files (default is `root_project/results_output/`).
|
|
44
44
|
- `--traceback`: Include detailed traceback information in the report.
|
|
45
45
|
- `--md-report`: Generate a Markdown report of the test results.
|
|
46
|
+
- `repo-name`: Specify the git repository name for the report.
|
|
46
47
|
- `--pr-number`: Include a pull request number in the report for better traceability.
|
|
47
48
|
- `--mr-number`: Include a merge request number in the report for better traceability.
|
|
49
|
+
- `--pipeline-number`: Include a CI pipeline number in the report for better traceability.
|
|
50
|
+
- `--commit`: Include the commit hash in the report for better traceability.
|
|
48
51
|
- `--add-parameters`: Add the test parameters as fields to the test results.
|
|
49
52
|
- `--pytest-command`: Add the detailed information about the pytest command-line to the "execution_results.json" file
|
|
50
53
|
<br> <br>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|