From 157ee1dbfb224080484e1ef07a2f200e0627fe11 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Wed, 11 Feb 2026 11:28:11 +0100 Subject: [PATCH] Automates parsing tests for all YAML examples Replaces manual listing of example files with dynamic discovery to ensure all present and future YAML examples are validated for parsing. Reduces maintenance and prevents omissions when new example files are added. --- test/unit/files/test_template_models.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/test/unit/files/test_template_models.py b/test/unit/files/test_template_models.py index c128e9f6790..ced17c7fe0c 100644 --- a/test/unit/files/test_template_models.py +++ b/test/unit/files/test_template_models.py @@ -1,3 +1,5 @@ +from pathlib import Path + from yaml import safe_load from galaxy.files.templates.examples import get_example @@ -291,19 +293,10 @@ def test_production_aws_public_bucket(): def test_examples_parse(): - _assert_example_parses("production_ftp.yml") - _assert_example_parses("production_azure.yml") - _assert_example_parses("production_aws_private_bucket.yml") - _assert_example_parses("production_aws_public_bucket.yml") - _assert_example_parses("production_s3fs.yml") - _assert_example_parses("production_dropbox.yml") - _assert_example_parses("s3fs_by_host_and_port.yml") - _assert_example_parses("templating_override.yml") - _assert_example_parses("admin_secrets.yml") - _assert_example_parses("admin_secrets_with_defaults.yml") - _assert_example_parses("testing_multi_version_with_secrets.yml") - _assert_example_parses("dropbox_client_secrets_in_vault.yml") - _assert_example_parses("dropbox_client_secrets_explicit.yml") + # Ensure every YAML example in `lib/galaxy/files/templates/examples/` parses without error + examples_dir = Path(__file__).resolve().parents[3] / "lib" / "galaxy" / "files" / "templates" / "examples" + for example_file in examples_dir.glob("*.yml"): + _assert_example_parses(example_file.name) def _assert_example_parses(filename: str):