From f694203b6c5ebe7dc0f71fe44e64ecc991e614c0 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Mon, 30 Oct 2023 09:45:20 +0000 Subject: [PATCH 1/2] fix: accept all alternative extentions for copier.yaml --- pytest_copie/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pytest_copie/plugin.py b/pytest_copie/plugin.py index 38fbea1..397341f 100644 --- a/pytest_copie/plugin.py +++ b/pytest_copie/plugin.py @@ -60,7 +60,8 @@ def copy( """ # set the template dir and the associated copier.yaml file template_dir = template_dir or self.default_template_dir - copier_yaml = template_dir / "copier.yaml" + files = template_dir.glob("copier.*") + copier_yaml = next(f for f in files if f.suffix in [".yaml", ".yml"]) # create a new output_dir in the test dir based on the counter value (output_dir := self.test_dir / f"copie{self.counter:03d}").mkdir() From 44b985a69d569e97c81c3f0c99ebcc4ba304fe87 Mon Sep 17 00:00:00 2001 From: Rambaud Pierrick <12rambau@users.noreply.github.com> Date: Tue, 31 Oct 2023 06:45:39 +0000 Subject: [PATCH 2/2] fix: catch StopIteration error --- pytest_copie/plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pytest_copie/plugin.py b/pytest_copie/plugin.py index 397341f..17f73e1 100644 --- a/pytest_copie/plugin.py +++ b/pytest_copie/plugin.py @@ -61,7 +61,10 @@ def copy( # set the template dir and the associated copier.yaml file template_dir = template_dir or self.default_template_dir files = template_dir.glob("copier.*") - copier_yaml = next(f for f in files if f.suffix in [".yaml", ".yml"]) + try: + copier_yaml = next(f for f in files if f.suffix in [".yaml", ".yml"]) + except StopIteration: + raise FileNotFoundError("No copier.yaml configuration file found.") # create a new output_dir in the test dir based on the counter value (output_dir := self.test_dir / f"copie{self.counter:03d}").mkdir()