Compare commits

...

3 Commits

Author SHA1 Message Date
Bojan Serafimov
612f1f2dba wip 2022-11-15 23:08:22 -05:00
Bojan Serafimov
accbf4a313 Merge branch 'main' into perf-summary 2022-11-15 13:10:20 -05:00
Bojan Serafimov
ea0207c4b7 WIP add perf test summary 2022-02-24 12:46:53 -05:00
2 changed files with 61 additions and 26 deletions

View File

@@ -440,35 +440,68 @@ def pytest_terminal_summary(
terminalreporter.section("Benchmark results", "-") terminalreporter.section("Benchmark results", "-")
result = [] # TODO group by test report
for test_report in terminalreporter.stats.get("passed", []): reports = {
result_entry = [] report.head_line: report
for report in terminalreporter.stats.get("passed", [])
}
for _, recorded_property in test_report.user_properties: results = []
terminalreporter.write( for name, report in reports.items():
"{}.{}: ".format(test_report.head_line, recorded_property["name"]) # terminalreporter.write(f"{name}", green=True)
) # terminalreporter.line("")
unit = recorded_property["unit"] if "[neon" in name:
value = recorded_property["value"] vanilla_report = reports.get(name.replace("[neon", "[vanilla"))
if unit == "MB": if vanilla_report:
terminalreporter.write("{0:,.0f}".format(value), green=True) for key, prop in report.user_properties:
elif unit in ("s", "ms") and isinstance(value, float): if prop["unit"] == "s":
terminalreporter.write("{0:,.3f}".format(value), green=True) neon_value = prop["value"]
elif isinstance(value, float): vanilla_value = dict(vanilla_report.user_properties)[key]["value"]
terminalreporter.write("{0:,.4f}".format(value), green=True) try:
else: ratio = float(neon_value) / vanilla_value
terminalreporter.write(str(value), green=True) except ZeroDivisionError:
terminalreporter.line(" {}".format(unit)) ratio = 99999
result_entry.append(recorded_property) results.append((ratio, name.replace("[neon", "[neon/vanilla"), prop["name"]))
result.append( results.sort(reverse=True)
{ for ratio, test, prop in results:
"suit": test_report.nodeid, terminalreporter.write("{}.{}: ".format(test, prop))
"total_duration": test_report.duration, terminalreporter.write("{0:,.3f}".format(ratio), green=True)
"data": result_entry, terminalreporter.line("")
}
) # result = []
# for test_report in terminalreporter.stats.get("passed", []):
# result_entry = []
# durations = [
# prop
# for _, prop in test_report.user_properties
# if prop["unit"] == "s"
# ]
# for _, recorded_property in test_report.user_properties:
# terminalreporter.write("{}.{}: ".format(test_report.head_line,
# recorded_property["name"]))
# unit = recorded_property["unit"]
# value = recorded_property["value"]
# if unit == "MB":
# terminalreporter.write("{0:,.0f}".format(value), green=True)
# elif unit in ("s", "ms") and isinstance(value, float):
# terminalreporter.write("{0:,.3f}".format(value), green=True)
# elif isinstance(value, float):
# terminalreporter.write("{0:,.4f}".format(value), green=True)
# else:
# terminalreporter.write(str(value), green=True)
# terminalreporter.line(" {}".format(unit))
# result_entry.append(recorded_property)
# result.append({
# "suit": test_report.nodeid,
# "total_duration": test_report.duration,
# "data": result_entry,
# })
out_dir = config.getoption("out_dir") out_dir = config.getoption("out_dir")
if out_dir is None: if out_dir is None:

View File

@@ -2661,6 +2661,8 @@ def test_output_dir(request: FixtureRequest, top_output_dir: Path) -> Iterator[P
yield test_dir yield test_dir
shutil.rmtree(test_dir)
allure_attach_from_dir(test_dir) allure_attach_from_dir(test_dir)