From cf9809721dee30666bf41641fe5c0db32388d18c Mon Sep 17 00:00:00 2001 From: Stefano Garzarella Date: Thu, 2 Nov 2023 19:03:01 +0100 Subject: [PATCH] test_coverage: calculate the difference in reverse If we increase the coverage the message prints a negative value as the difference from the previous value. This can be confusing as it looks like the coverage has decreased. For example if the value in coverage_config_x86_64.json is 73.42, and the new coverage is 73.96 (increased), we have the following error: ValueError: Current code coverage (73.96%) deviates by -0.54% from the previous code co... Let's calculate the difference in reverse so that we have a negative value if it decreases and positive otherwise. Signed-off-by: Stefano Garzarella --- integration_tests/test_coverage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration_tests/test_coverage.py b/integration_tests/test_coverage.py index 842502e..9ca62c7 100644 --- a/integration_tests/test_coverage.py +++ b/integration_tests/test_coverage.py @@ -116,7 +116,7 @@ def test_coverage(profile, no_cleanup, test_scope): coverage_config = _read_test_config() current_coverage = _get_current_coverage(coverage_config, no_cleanup, test_scope) previous_coverage = coverage_config["coverage_score"] - diff = previous_coverage - current_coverage + diff = current_coverage - previous_coverage upper = previous_coverage + MAX_DELTA arch = platform.machine()