pytest-html-plus 0.4.7__py3-none-any.whl → 0.4.9__py3-none-any.whl
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_html_plus/compute_report_metadata.py +3 -4
- pytest_html_plus/generate_html_report.py +69 -13
- pytest_html_plus/plugin.py +12 -5
- pytest_html_plus/utils.py +1 -1
- {pytest_html_plus-0.4.7.dist-info → pytest_html_plus-0.4.9.dist-info}/METADATA +2 -2
- {pytest_html_plus-0.4.7.dist-info → pytest_html_plus-0.4.9.dist-info}/RECORD +9 -9
- {pytest_html_plus-0.4.7.dist-info → pytest_html_plus-0.4.9.dist-info}/LICENSE +0 -0
- {pytest_html_plus-0.4.7.dist-info → pytest_html_plus-0.4.9.dist-info}/WHEEL +0 -0
- {pytest_html_plus-0.4.7.dist-info → pytest_html_plus-0.4.9.dist-info}/entry_points.txt +0 -0
|
@@ -8,16 +8,15 @@ from pytest_html_plus.utils import is_main_worker, get_env_marker, get_report_ti
|
|
|
8
8
|
def write_plus_metadata_if_main_worker(config, report_path, output_path="plus_metadata.json", **kwargs):
|
|
9
9
|
if not is_main_worker():
|
|
10
10
|
return
|
|
11
|
-
branch = kwargs.get("git_branch", "
|
|
12
|
-
commit = kwargs.get("git_commit", "
|
|
11
|
+
branch = kwargs.get("git_branch", "Pass --git-branch to populate git metadata")
|
|
12
|
+
commit = kwargs.get("git_commit", "Pass --git-commit to populate git metadata")
|
|
13
13
|
metadata = {
|
|
14
14
|
"report_title": get_report_title(output_path=report_path),
|
|
15
|
-
"environment": get_env_marker(config),
|
|
15
|
+
"environment": kwargs.get("rp_env") or get_env_marker(config),
|
|
16
16
|
"branch": branch,
|
|
17
17
|
"commit": commit,
|
|
18
18
|
"python_version": get_python_version(),
|
|
19
19
|
"generated_at": datetime.now().isoformat()
|
|
20
20
|
}
|
|
21
21
|
with open(output_path, "w") as f:
|
|
22
|
-
print(metadata)
|
|
23
22
|
json.dump(metadata, f, indent=2)
|
|
@@ -60,6 +60,7 @@ class JSONReporter:
|
|
|
60
60
|
else:
|
|
61
61
|
self.metadata = {}
|
|
62
62
|
|
|
63
|
+
|
|
63
64
|
def log_result(
|
|
64
65
|
self,
|
|
65
66
|
test_name,
|
|
@@ -148,6 +149,22 @@ class JSONReporter:
|
|
|
148
149
|
return os.path.join("screenshots", file)
|
|
149
150
|
return None
|
|
150
151
|
|
|
152
|
+
def copy_json_report(self):
|
|
153
|
+
"""
|
|
154
|
+
Copies the source JSON report into the report output directory.
|
|
155
|
+
"""
|
|
156
|
+
if not os.path.exists(self.report_path):
|
|
157
|
+
return
|
|
158
|
+
|
|
159
|
+
os.makedirs(self.output_dir, exist_ok=True)
|
|
160
|
+
|
|
161
|
+
dest_path = os.path.join(
|
|
162
|
+
self.output_dir,
|
|
163
|
+
os.path.basename(self.report_path)
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
shutil.copyfile(self.report_path, dest_path)
|
|
167
|
+
|
|
151
168
|
def generate_copy_button(self, content, label):
|
|
152
169
|
if isinstance(content, list):
|
|
153
170
|
# Convert list to string (for logs)
|
|
@@ -169,6 +186,7 @@ class JSONReporter:
|
|
|
169
186
|
|
|
170
187
|
def generate_html_report(self):
|
|
171
188
|
# Extract all unique markers
|
|
189
|
+
self.copy_json_report()
|
|
172
190
|
ignore_markers = {"link"}
|
|
173
191
|
all_markers = set()
|
|
174
192
|
for test in self.results:
|
|
@@ -184,16 +202,35 @@ class JSONReporter:
|
|
|
184
202
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
185
203
|
<style>
|
|
186
204
|
|
|
187
|
-
body {{
|
|
188
|
-
|
|
205
|
+
body {{
|
|
206
|
+
font-family: Arial, sans-serif;
|
|
207
|
+
padding: 1rem;
|
|
208
|
+
background: #FAF7F2;
|
|
209
|
+
}}
|
|
210
|
+
.test {{
|
|
211
|
+
border: 1px solid #D9C3A5;
|
|
212
|
+
margin-bottom: 0.5rem;
|
|
213
|
+
border-radius: 5px;
|
|
214
|
+
background: #FDFBF7;
|
|
215
|
+
}}
|
|
189
216
|
.header {{ padding: 0.5rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }}
|
|
190
|
-
.header.passed {{
|
|
191
|
-
|
|
192
|
-
|
|
217
|
+
.header.passed {{
|
|
218
|
+
background: #E1F3E8;
|
|
219
|
+
color: #1E6B3A;
|
|
220
|
+
border-left: 4px solid #2E7D32;
|
|
221
|
+
}}
|
|
222
|
+
.header.failed {{
|
|
223
|
+
background: #FBE4E4;
|
|
224
|
+
color: #8B1E1E;
|
|
225
|
+
border-left: 4px solid #C62828;
|
|
226
|
+
}}
|
|
227
|
+
.header.skipped {{
|
|
228
|
+
background: #fff8e1;
|
|
229
|
+
color: #b36b00;
|
|
230
|
+
}}
|
|
193
231
|
.header.error {{
|
|
194
|
-
background: #fdecea;
|
|
195
|
-
color: #b71c1c;
|
|
196
|
-
border-left: 4px solid #d32f2f;
|
|
232
|
+
background: #fdecea;
|
|
233
|
+
color: #b71c1c;
|
|
197
234
|
}}
|
|
198
235
|
.details {{ padding: 0.5rem 1rem; display: none; border-top: 1px solid #ddd; }}
|
|
199
236
|
.toggle::before {{ content: "▶"; display: inline-block; margin-right: 0.5rem; transition: transform 0.3s ease; }}
|
|
@@ -293,6 +330,13 @@ class JSONReporter:
|
|
|
293
330
|
width: 100%;
|
|
294
331
|
border-collapse: collapse;
|
|
295
332
|
}}
|
|
333
|
+
|
|
334
|
+
.muted-hint code {{
|
|
335
|
+
background: #f1f5f9;
|
|
336
|
+
padding: 2px 4px;
|
|
337
|
+
border-radius: 4px;
|
|
338
|
+
font-size: 0.9em;
|
|
339
|
+
}}
|
|
296
340
|
|
|
297
341
|
.report-metadata th, .report-metadata td {{
|
|
298
342
|
text-align: left;
|
|
@@ -587,8 +631,8 @@ class JSONReporter:
|
|
|
587
631
|
</script>
|
|
588
632
|
</head>
|
|
589
633
|
<body>
|
|
590
|
-
<div class="report-metadata">
|
|
591
|
-
<h2 onclick="this.nextElementSibling.classList.toggle('hidden')" style="cursor: pointer; font-size: 12px;">
|
|
634
|
+
<div class="report-metadata" style="background: #f2f4f7;">
|
|
635
|
+
<h2 onclick="this.nextElementSibling.classList.toggle('hidden')" style="cursor: pointer; font-size: 12px; ">
|
|
592
636
|
Execution Metadata (click to toggle)
|
|
593
637
|
{self.generate_copy_button(self.metadata, "metadata")}
|
|
594
638
|
</h2>
|
|
@@ -683,9 +727,21 @@ class JSONReporter:
|
|
|
683
727
|
|
|
684
728
|
# Add checkboxes for all markers
|
|
685
729
|
marker_counts = self.filters.get("marker_counts", {})
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
730
|
+
if not marker_counts:
|
|
731
|
+
html += (
|
|
732
|
+
'<span class="muted-hint">'
|
|
733
|
+
'Use <code>pytest.mark.*</code> to enable marker filters'
|
|
734
|
+
'</span>'
|
|
735
|
+
)
|
|
736
|
+
else:
|
|
737
|
+
for marker in sorted(marker_counts):
|
|
738
|
+
count = marker_counts[marker]
|
|
739
|
+
html += (
|
|
740
|
+
f'<label>'
|
|
741
|
+
f'<input type="checkbox" value="{marker}" /> '
|
|
742
|
+
f'{marker} ({count})'
|
|
743
|
+
f'</label> '
|
|
744
|
+
)
|
|
689
745
|
|
|
690
746
|
html += '<div id="tests-container">'
|
|
691
747
|
|
pytest_html_plus/plugin.py
CHANGED
|
@@ -177,14 +177,15 @@ def pytest_sessionfinish(session, exitstatus):
|
|
|
177
177
|
|
|
178
178
|
def pytest_sessionstart(session):
|
|
179
179
|
html_output = session.config.getoption("--html-output") or "report_output"
|
|
180
|
-
git_branch = session.config.getoption("--git-branch") or "
|
|
181
|
-
git_commit = session.config.getoption("--git-commit") or "
|
|
180
|
+
git_branch = session.config.getoption("--git-branch") or "Pass --git-branch to populate git metadata"
|
|
181
|
+
git_commit = session.config.getoption("--git-commit") or "Pass --git-commit to populate git metadata"
|
|
182
|
+
rp_env = session.config.getoption("--rp-env") or "Pass --env or --environment or --rp-env <name> to populate environment"
|
|
182
183
|
configure_logging()
|
|
183
184
|
session.config.addinivalue_line(
|
|
184
185
|
"markers", "link(url): Add a link to external test case or documentation."
|
|
185
186
|
)
|
|
186
187
|
write_plus_metadata_if_main_worker(session.config, report_path=html_output,
|
|
187
|
-
git_branch=git_branch, git_commit=git_commit)
|
|
188
|
+
git_branch=git_branch, git_commit=git_commit, rp_env=rp_env)
|
|
188
189
|
|
|
189
190
|
|
|
190
191
|
def pytest_load_initial_conftests(args):
|
|
@@ -242,15 +243,21 @@ def pytest_addoption(parser):
|
|
|
242
243
|
parser.addoption(
|
|
243
244
|
"--git-branch",
|
|
244
245
|
action="store",
|
|
245
|
-
default="
|
|
246
|
+
default="Pass --git-branch to populate git metadata",
|
|
246
247
|
help="Helps show branch information on the report"
|
|
247
248
|
)
|
|
248
249
|
parser.addoption(
|
|
249
250
|
"--git-commit",
|
|
250
251
|
action="store",
|
|
251
|
-
default="
|
|
252
|
+
default="Pass --git-commit to populate git metadata",
|
|
252
253
|
help="Helps show commitId information on the report"
|
|
253
254
|
)
|
|
255
|
+
parser.addoption(
|
|
256
|
+
"--rp-env",
|
|
257
|
+
action="store",
|
|
258
|
+
default="Pass --env or --environment or --rp-env <name> to populate environment",
|
|
259
|
+
help="Helps show env information on the report"
|
|
260
|
+
)
|
|
254
261
|
|
|
255
262
|
import logging
|
|
256
263
|
import sys
|
pytest_html_plus/utils.py
CHANGED
|
@@ -7,7 +7,7 @@ def get_env_marker(config):
|
|
|
7
7
|
for arg in ("--env", "--environment"):
|
|
8
8
|
if config.getoption(arg.lstrip("-").replace("-", "_"), default=None):
|
|
9
9
|
return config.getoption(arg.lstrip("-").replace("-", "_"))
|
|
10
|
-
return "
|
|
10
|
+
return "Pass --env or --rp-env or --environment <name> to populate environment"
|
|
11
11
|
|
|
12
12
|
def get_report_title(output_path):
|
|
13
13
|
report_path = output_path
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pytest-html-plus
|
|
3
|
-
Version: 0.4.
|
|
4
|
-
Summary: Generate Actionable, automatic screenshots, unified Pytest HTML report in less than 3 seconds — no hooks, merge plugins, no config, xdist-ready.
|
|
3
|
+
Version: 0.4.9
|
|
4
|
+
Summary: Generate Actionable, automatic screenshots, unified Mobile friendly Pytest HTML report in less than 3 seconds — no hooks, merge plugins, no config, xdist-ready.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: pytest,pytest-html-plus,pytest-plugin,html-test-report,beautiful-test-report,shareable-test-results,test-report,test-results,unit-test-report,functional-test-report,test-summary,reporting,python-testing,automated-testing,test-runner,report-generator,continuous-integration,ci-cd,github-actions,jenkins,pytest-html,pytest-report
|
|
7
7
|
Author: reporterplus
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
pytest_html_plus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
pytest_html_plus/compute_filter_counts.py,sha256=FznjPos-bgYSi8bERG_WbaZWMQDIAfoYP4QTRbe8vHw,963
|
|
3
|
-
pytest_html_plus/compute_report_metadata.py,sha256=
|
|
3
|
+
pytest_html_plus/compute_report_metadata.py,sha256=XnpmTGGSpuXJvyFnxIWs5I1QlWte6qSHdCbgLMgTxYA,863
|
|
4
4
|
pytest_html_plus/extract_link.py,sha256=1XtqkbZkrl1YgPGtFc3Ss1XFWm4LNLuO3Hi407HNChk,340
|
|
5
|
-
pytest_html_plus/generate_html_report.py,sha256=
|
|
5
|
+
pytest_html_plus/generate_html_report.py,sha256=i-OUnakUAEwvbm6Pb8ZjoauoVrbW7Ia-tNFzBERCAI0,37646
|
|
6
6
|
pytest_html_plus/json_merge.py,sha256=EQu23n8z4a0FxvFOlvYoDlX1jrZYjWwsCL-6oxfDREw,1868
|
|
7
7
|
pytest_html_plus/json_to_xml_converter.py,sha256=5E6BGMw4FaJhoYDUZQ6dF8NWqAeXrcuSrlySy81IrVE,3468
|
|
8
|
-
pytest_html_plus/plugin.py,sha256=
|
|
8
|
+
pytest_html_plus/plugin.py,sha256=9ofatZswVZEOJ4P3SZgv4B4j_RsVAEa1mU_73aOOW3s,12470
|
|
9
9
|
pytest_html_plus/resolver_driver.py,sha256=hehokRO5EuG4Ti8MyaSBW4xaHduUK3Ot2jbw1YpIsnk,1287
|
|
10
10
|
pytest_html_plus/send_email_report.py,sha256=qDnAPy1Jc4favOvXg6MT0ttNmSsG3MXGQX1Hu7wN1Go,2622
|
|
11
|
-
pytest_html_plus/utils.py,sha256=
|
|
12
|
-
pytest_html_plus-0.4.
|
|
13
|
-
pytest_html_plus-0.4.
|
|
14
|
-
pytest_html_plus-0.4.
|
|
15
|
-
pytest_html_plus-0.4.
|
|
16
|
-
pytest_html_plus-0.4.
|
|
11
|
+
pytest_html_plus/utils.py,sha256=bSCxZGq6g_A6LVZvPfZ3xEQUmW6Ferhhj4fbjQAWgD0,2273
|
|
12
|
+
pytest_html_plus-0.4.9.dist-info/LICENSE,sha256=8flU0ghLnuKK8qZv9pJ1xhXiKQdUncg0OvqMwYhGWzY,1090
|
|
13
|
+
pytest_html_plus-0.4.9.dist-info/METADATA,sha256=tFZ7LsK8U5-MlsoYSewJxMRKljQ1JYvL0Q4jdBCCvnE,8520
|
|
14
|
+
pytest_html_plus-0.4.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
15
|
+
pytest_html_plus-0.4.9.dist-info/entry_points.txt,sha256=eSbV9G_n_XnR4wemMxKHSSuPMcBSoHbE1WuC2IQp4Zk,53
|
|
16
|
+
pytest_html_plus-0.4.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|