From 746fe8967c5d2e1c4c1a880353a2299b64cc37cc Mon Sep 17 00:00:00 2001 From: Sami Jaghouar Date: Sat, 21 Sep 2024 23:34:29 +0000 Subject: [PATCH] fix tests configs --- tests/test_configs.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/test_configs.py b/tests/test_configs.py index 0873750c..eff493a6 100644 --- a/tests/test_configs.py +++ b/tests/test_configs.py @@ -8,12 +8,22 @@ import pytest import tomli -config_file_names = [file for file in os.listdir("configs") if file.endswith(".toml")] +def get_all_toml_files(directory): + toml_files = [] + for root, _, files in os.walk(directory): + for file in files: + if file.endswith(".toml"): + toml_files.append(os.path.join(root, file)) + return toml_files -@pytest.mark.parametrize("config_file_name", config_file_names) -def test_load_config(config_file_name): - with open(f"configs/{config_file_name}", "rb") as f: + +config_file_paths = get_all_toml_files("configs") + + +@pytest.mark.parametrize("config_file_path", config_file_paths) +def test_load_config(config_file_path): + with open(f"{config_file_path}", "rb") as f: content = tomli.load(f) config = Config(**content) assert config is not None