From f1da68b835b781643da8f917858de9b1729f8d3f Mon Sep 17 00:00:00 2001
From: Andres Toom <toom@adacore.com>
Date: Mon, 5 Aug 2024 18:27:44 +0300
Subject: [PATCH] Ensure deterministic checking in
 check_unit_test_file_coverage_test

Ref. None
---
 tools/check_unit_test_file_coverage.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/check_unit_test_file_coverage.py b/tools/check_unit_test_file_coverage.py
index 9395653c0..ec339c8e4 100755
--- a/tools/check_unit_test_file_coverage.py
+++ b/tools/check_unit_test_file_coverage.py
@@ -39,10 +39,14 @@ def check_file_coverage(
 
     ignore = ignore or []
 
-    source_files = [
-        s.relative_to(source_dir) for ext in ("**/*.py", "**/*.pyi") for s in source_dir.glob(ext)
-    ]
-    test_files = [t.relative_to(test_dir) for t in test_dir.glob("**/*.py")]
+    source_files = sorted(
+        [
+            s.relative_to(source_dir)
+            for ext in ("**/*.py", "**/*.pyi")
+            for s in source_dir.glob(ext)
+        ],
+    )
+    test_files = sorted([t.relative_to(test_dir) for t in test_dir.glob("**/*.py")])
 
     excess_source_files = [
         str(source_file)