Skip to content

Commit 4065b5e

Browse files
Potential fixes for 5 code quality findings (#211)
* Apply suggested fix to pytest_html_plus/generate_html_report.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to pytest_html_plus/generate_html_report.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to pytest_html_plus/generate_html_report.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to pytest_html_plus/generate_html_report.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to pytest_html_plus/generate_html_report.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
1 parent e280104 commit 4065b5e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

pytest_html_plus/generate_html_report.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def write_report(self):
122122
with open(self.report_path, "w") as f:
123123
json.dump(data, f, indent=2)
124124
except Exception as e:
125-
raise RuntimeError(f"Failed to write report to '{path}': {e}") from e
125+
raise RuntimeError(f"Failed to write report to '{self.report_path}': {e}") from e
126126

127127
def copy_all_screenshots(self):
128128
screenshots_output_dir = os.path.join(self.output_dir, "screenshots")
@@ -136,12 +136,12 @@ def copy_all_screenshots(self):
136136
shutil.copyfile(src_path, dest_path)
137137

138138
def find_screenshot_and_copy(self, test_name):
139-
screenshots_output_dir = os.path.join(self.output_dir, "screenshots")
140-
os.makedirs(screenshots_output_dir, exist_ok=True)
141139
"""
142140
We'll look for any .png file where test_name
143141
is contained in the filename (partial match)
144142
"""
143+
screenshots_output_dir = os.path.join(self.output_dir, "screenshots")
144+
os.makedirs(screenshots_output_dir, exist_ok=True)
145145
for root, _, files in os.walk(self.screenshots_dir):
146146
for file in files:
147147
if file.endswith(".png") and test_name in file:
@@ -228,7 +228,7 @@ def generate_html_report(self):
228228
.details-content {{ display: flex; gap: 1rem; align-items: flex-start; }}
229229
.details-text {{ flex: 1; min-width: 0; }}
230230
.details-screenshot {{ flex-shrink: 0; margin: 1rem; box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1); }}
231-
.details-screenshot img {{width: 300px; height: 200px; object-fit: contain; border: 1px solid #ccc; border-radius: 3px; background: #f8f8f8; cursor: pointer; transition: transform 0.2s ease; transform: scale(1.05); }}
231+
.details-screenshot img {{width: 300px; height: 200px; object-fit: contain; border: 1px solid #ccc; border-radius: 3px; background: #f8f8f8; cursor: pointer; transition: transform 0.2s ease; }}
232232
.details-screenshot img:hover {{ transform: scale(1.05); }}
233233
234234
/* Handle content wrapping */
@@ -310,7 +310,7 @@ def generate_html_report(self):
310310
}}
311311
312312
.report-metadata summary {{
313-
font-size: 0.5em;
313+
font-size: 0.9em;
314314
cursor: pointer;
315315
margin-bottom: 5px;
316316
}}
@@ -441,7 +441,7 @@ def generate_html_report(self):
441441
skippedCheckbox.checked = false;
442442
failedCheckbox.checked = false;
443443
errorCheckbox.checked = false;
444-
flakyCheckbox.checked = false
444+
flakyCheckbox.checked = false;
445445
testCards.forEach(card => {{
446446
const hasLink = card.querySelector('a[href]');
447447
card.style.display = hasLink ? 'none' : 'block';

0 commit comments

Comments
 (0)