From 27456ed2b57f0114cc976d9d74b98c9762818ca3 Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Tue, 8 Oct 2024 21:53:39 +0200 Subject: [PATCH] twister: blackbox: coverage: fix matching pattern Fix the expected pattern randomly matched to coverage.json contents ordered differently at test_coverage_basedir(). Signed-off-by: Dmitrii Golovanov --- scripts/tests/twister_blackbox/test_coverage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tests/twister_blackbox/test_coverage.py b/scripts/tests/twister_blackbox/test_coverage.py index c1bf926abb4523..667dc4b940f8fe 100644 --- a/scripts/tests/twister_blackbox/test_coverage.py +++ b/scripts/tests/twister_blackbox/test_coverage.py @@ -47,7 +47,7 @@ class TestCoverage: 'coverage.log', 'coverage.json', 'coverage' ], - r'{"files": \[], "gcovr/format_version": ".*"}' + r'{"files": \[\], "gcovr/format_version": ".*"}' ), ] TESTDATA_4 = [ @@ -244,7 +244,7 @@ def test_coverage_basedir(self, capfd, test_path, test_platforms, out_path, file with open(path, "r") as json_file: json_content = json.load(json_file) pattern = re.compile(expected_content) - assert pattern.match(json.dumps(json_content)) + assert pattern.match(json.dumps(json_content, sort_keys=True)) if os.path.exists(base_dir): os.rmdir(base_dir)