From b8ff00cfdf718b32b80528ee241df82e91472269 Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Fri, 13 Oct 2023 20:47:18 -0400 Subject: [PATCH] test: alters test_compdef.py to make the file to test deterministic Signed-off-by: Jennifer Power --- tests/trestlebot/tasks/authored/test_compdef.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/trestlebot/tasks/authored/test_compdef.py b/tests/trestlebot/tasks/authored/test_compdef.py index 6a275807..fc8266f8 100644 --- a/tests/trestlebot/tasks/authored/test_compdef.py +++ b/tests/trestlebot/tasks/authored/test_compdef.py @@ -17,6 +17,7 @@ """Test for Trestle Bot Authored Compdef.""" import pathlib +import re import pytest @@ -52,8 +53,11 @@ def test_create_new_default(tmp_trestle_dir: str) -> None: yaml_files = list(comp_dir.glob(f"*{YAML_EXTENSION}")) assert len(yaml_files) == 12 + rule_file = next((file for file in yaml_files if re.search(r'ac-5', file.stem)), None) + assert rule_file is not None + # Read one of the files and check the content - rule_path = pathlib.Path(yaml_files[0]) + rule_path = pathlib.Path(rule_file) rule_stream = rule_path.read_text() transformer = ToRulesYAMLTransformer()