Skip to content

Commit c80f784

Browse files
authored
Removed verbose and upgraded package (#69)
1 parent 33a7fd6 commit c80f784

4 files changed

Lines changed: 6 additions & 21 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pytest-reporter-plus"
3-
version = "0.2.6"
3+
version = "0.2.8"
44
description = "Lightweight enhanced HTML reporter for Pytest"
55
readme = "README.md"
66
authors = ["Emjey", "Karan"]

pytest_reporter_plus/generate_html_report.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,19 @@ def write_report(self):
8686
try:
8787
with open(self.report_path, "w", encoding="utf-8") as f:
8888
json.dump(self.results, f, indent=2)
89-
print(f"✅ JSON report successfully written")
9089
except Exception as e:
9190
print(f"❌ Failed to write JSON report ")
9291

9392
def copy_all_screenshots(self):
9493
screenshots_output_dir = os.path.join(self.output_dir, "screenshots")
9594
os.makedirs(screenshots_output_dir, exist_ok=True)
96-
97-
print(f"📦 Copying all .png files from '{self.screenshots_dir}' to '{screenshots_output_dir}'")
98-
9995
for root, _, files in os.walk(self.screenshots_dir):
10096
for file in files:
10197
if file.endswith(".png"):
10298
src_path = os.path.join(root, file)
10399
dest_path = os.path.join(screenshots_output_dir, file)
104100
if not os.path.exists(dest_path):
105101
shutil.copyfile(src_path, dest_path)
106-
print(f"✅ Copied: {src_path}{dest_path}")
107102

108103
def find_screenshot_and_copy(self, test_name):
109104
screenshots_output_dir = os.path.join(self.output_dir, "screenshots")

pytest_reporter_plus/json_merge.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def merge_json_reports(directory=".pytest_worker_jsons", output_path="playwright
3333
final_test["flaky_attempts"] = [t.get("status") for t in attempts]
3434
merged_results.append(final_test)
3535

36-
with open(output_path, "w") as f:
37-
json.dump(merged_results, f, indent=2)
38-
39-
print(f"✅ Merged report written to {output_path}")
36+
try:
37+
with open(output_path, "w") as f:
38+
json.dump(merged_results, f, indent=2)
39+
except Exception as e:
40+
print(f"❌ Failed to write merged report to {output_path}: {e}")

pytest_reporter_plus/plugin.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,10 @@ def pytest_sessionfinish(session, exitstatus):
104104
return
105105

106106
if is_xdist:
107-
print("Merging reports in main process...")
108107
merge_json_reports(directory=".pytest_worker_jsons", output_path=json_path)
109-
print(f"✅ Merged report written to {json_path}")
110108
else:
111109
reporter.results = mark_flaky_tests(reporter.results)
112110
reporter.write_report()
113-
print(f"✅ Standalone JSON report written to {json_path}")
114111

115112
script_path = os.path.join(os.path.dirname(__file__), "generate_html_report.py")
116113

@@ -126,7 +123,6 @@ def pytest_sessionfinish(session, exitstatus):
126123
"--screenshots", screenshots,
127124
"--output", html_output
128125
], check=True)
129-
print(f"✅ HTML report generated at {html_output}/report.html")
130126
except Exception as e:
131127
print(f"❌ Exception during HTML report generation: {e}")
132128

@@ -141,16 +137,11 @@ def pytest_sessionfinish(session, exitstatus):
141137

142138
def pytest_sessionstart(session):
143139
configure_logging()
144-
print("Plugin loaded: pytest_sessionstart called")
145140
session.config.addinivalue_line(
146141
"markers", "link(url): Add a link to external test case or documentation."
147142
)
148143

149144

150-
def pytest_runtest_logreport(report):
151-
print(f"pytest_runtest_logreport: {report.nodeid} - {report.outcome}")
152-
153-
154145
def pytest_load_initial_conftests(args):
155146
if not any(arg.startswith("--capture") for arg in args):
156147
args.append("--capture=tee-sys")
@@ -192,9 +183,7 @@ def pytest_addoption(parser):
192183
help="Helps capture flaky tests in the last n number of builds"
193184
)
194185

195-
196186
def take_screenshot_on_failure(item, page):
197-
print("✅ take_screenshot_on_failure was called")
198187
screenshot_dir = os.path.join(os.getcwd(), "screenshots")
199188
os.makedirs(screenshot_dir, exist_ok=True)
200189
filename = f"{item.name}.png".replace("/", "_").replace("\\", "_")

0 commit comments

Comments
 (0)