Skip to content

Commit

Permalink
Adding in CPU time tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thijssnelleman committed Nov 29, 2024
1 parent 2b8072f commit f3de009
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_runner/test_target_algorithm_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ def test_serial_runs(make_runner: Callable[..., TargetFunctionRunner]) -> None:
_, first_run_value = first
_, second_run_value = second
assert int(first_run_value.endtime) <= int(second_run_value.starttime)

# For these examples, runtime must be larger or equal to cputime
assert first_run_value.time >= first_run_value.cpu_time
assert second_run_value.time >= second_run_value.cpu_time
# And cpu time must be near zero because the target function just sleeps
assert first_run_value.cpu_time < 0.001
assert second_run_value.cpu_time < 0.001

def test_fail(make_runner: Callable[..., TargetFunctionRunner]) -> None:
"""Test traceback and error end up in the additional info of a failing run"""
Expand Down

0 comments on commit f3de009

Please sign in to comment.