Skip to content

Commit 7490d59

Browse files
authored
Extend tests summary table (#626)
1 parent 57f1447 commit 7490d59

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

tools/tests/build_docker_images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def main():
7474
t = time.perf_counter()
7575
result = systemtest.run_only_build(run_directory)
7676
elapsed_time = time.perf_counter() - t
77-
logging.info(f"Building image for {systemtest} took {elapsed_time} seconds")
77+
logging.info(f"Building image for {systemtest} took {elapsed_time:^.1f} seconds")
7878
results.append(result)
7979

8080
build_docker_success = True

tools/tests/generate_reference_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def main():
123123
t = time.perf_counter()
124124
result = systemtest.run_for_reference_results(run_directory)
125125
elapsed_time = time.perf_counter() - t
126-
logging.info(f"Running {systemtest} took {elapsed_time} seconds")
126+
logging.info(f"Running {systemtest} took {elapsed_time:^.1f} seconds")
127127
if not result.success:
128128
raise RuntimeError(f"Failed to execute {systemtest}")
129129
reference_result_per_tutorial[systemtest.tutorial] = []

tools/tests/systemtests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def main():
7474
t = time.perf_counter()
7575
result = systemtest.run(run_directory)
7676
elapsed_time = time.perf_counter() - t
77-
logging.info(f"Running {systemtest} took {elapsed_time} seconds")
77+
logging.info(f"Running {systemtest} took {elapsed_time:^.1f} seconds")
7878
results.append(result)
7979

8080
system_test_success = True

tools/tests/systemtests/Systemtest.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,27 +84,36 @@ def _get_length_of_name(results: List[SystemtestResult]) -> int:
8484
max_name_length = _get_length_of_name(results)
8585

8686
header = f"| {'systemtest':<{max_name_length + 2}} | {'success':^7} | {'building time [s]':^17} | {'solver time [s]':^15} | {'fieldcompare time [s]':^21} |"
87-
separator = "+-" + "-" * (max_name_length + 2) + \
87+
separator_plaintext = "+-" + "-" * (max_name_length + 2) + \
8888
"-+---------+-------------------+-----------------+-----------------------+"
89+
separator_markdown = "| --- | --- | --- | --- | --- |"
8990

90-
print(separator)
91+
print(separator_plaintext)
9192
print(header)
92-
print(separator)
93+
print(separator_plaintext)
9394

9495
if "GITHUB_STEP_SUMMARY" in os.environ:
9596
with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as f:
96-
print(separator, file=f)
9797
print(header, file=f)
98-
print(separator, file=f)
98+
print(separator_markdown, file=f)
9999

100100
for result in results:
101-
row = f"| {str(result.systemtest):<{max_name_length + 2}} | {result.success:^7} | {result.build_time:^17.2f} | {result.solver_time:^15.2f} | {result.fieldcompare_time:^21.2f} |"
101+
row = f"| {str(result.systemtest):<{max_name_length + 2}} | {result.success:^7} | {result.build_time:^17.1f} | {result.solver_time:^15.1f} | {result.fieldcompare_time:^21.1f} |"
102102
print(row)
103-
print(separator)
103+
print(separator_plaintext)
104104
if "GITHUB_STEP_SUMMARY" in os.environ:
105105
with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as f:
106106
print(row, file=f)
107-
print(separator, file=f)
107+
108+
if "GITHUB_STEP_SUMMARY" in os.environ:
109+
with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as f:
110+
print("\n\n", file=f)
111+
print(
112+
"In case a test fails, download the archive from the bottom of this page and look into each `stdout.log` and `stderr.log`. The time spent in each step might already give useful hints.",
113+
file=f)
114+
print(
115+
"See the [documentation](https://precice.org/dev-docs-system-tests.html#understanding-what-went-wrong).",
116+
file=f)
108117

109118

110119
@dataclass

0 commit comments

Comments
 (0)