diff options
| author | Martin Hořeňovský | 2020-07-06 20:02:20 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-07-26 10:47:58 +0200 |
| commit | e6d947f6d4f84713637da5e5b37cd1f84b925403 (patch) | |
| tree | da9042ccaa9bfabb39e3d70aaa5904ead4f8a6a2 /tests/TestScripts | |
| parent | 80b0d6975c1582d03436ba82146983d557b0a1a6 (diff) | |
| download | catch3-e6d947f6d4f84713637da5e5b37cd1f84b925403.tar.gz | |
Refactor tests for duration reporting threshold
Diffstat (limited to 'tests/TestScripts')
| -rw-r--r-- | tests/TestScripts/testTimeThreshold.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/tests/TestScripts/testTimeThreshold.py b/tests/TestScripts/testTimeThreshold.py deleted file mode 100644 index 51804aae..00000000 --- a/tests/TestScripts/testTimeThreshold.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python3 - -import subprocess -import sys - -def run_tests_with_threshold(self_test_exe, threshold): - cmd = [self_test_exe, '--min-duration', str(threshold), - '[min_duration_test]'] - process = subprocess.Popen( - cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = process.communicate() - if stderr: - raise RuntimeError("Unexpected error output:\n" + - stderr.decode()) - if process.returncode != 0: - raise RuntimeError("Unexpected failure to run tests\n") - result = stdout.split(b'\n') - report_lines = [s.split() for s in result if b' s: ' in s] - tests_reported = [l[2] for l in report_lines] - times_reported = [float(l[0]) for l in report_lines] - return tests_reported, times_reported - -def check_times_at_least(times_reported, minimum): - for time in times_reported: - assert time >= minimum, ( - 'Time {} was less that requested minimum {}' .format( - time, minimum)) - -def main(): - self_test_exe, = sys.argv[1:] - tests, times = run_tests_with_threshold(self_test_exe, '0.15') - assert tests == [b'sleep_for_200ms'], ( - "Unexpected tests reported %s" % tests) - check_times_at_least(times, 0.15) - tests,times = run_tests_with_threshold(self_test_exe, '0') - assert tests == [b'sleep_for_100ms', b'sleep_for_200ms'], ( - "Unexpected tests reported %s" % tests) - check_times_at_least(times, 0) - -if __name__ == '__main__': - sys.exit(main()) |