From 5af1050d9d3d8664631ea28d34389b412531db68 Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Mon, 20 Feb 2023 13:07:58 -0800 Subject: [PATCH] Split "we use the config" and "we use no config" so pytest won't try to consume config_file as a fixture --- tests/lib/given_steps.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/lib/given_steps.py b/tests/lib/given_steps.py index cf2053d5..dfb10615 100644 --- a/tests/lib/given_steps.py +++ b/tests/lib/given_steps.py @@ -83,15 +83,15 @@ def we_have_type_of_keyring(keyring_type): return TestKeyring() -@given(parse('we use the config "{config_file}"'), target_fixture="config_path") @given(parse("we use no config"), target_fixture="config_path") +def we_use_no_config(temp_dir): + os.chdir(temp_dir.name) # @todo move this step to a more universal place + return os.path.join(temp_dir.name, "non_existing_config.yaml") + +@given(parse('we use the config "{config_file}"'), target_fixture="config_path") def we_use_the_config(request, temp_dir, working_dir, config_file): - # Move into temp dir as cwd - os.chdir(temp_dir.name) - - if not config_file: - return os.path.join(temp_dir.name, "non_existing_config.yaml") + os.chdir(temp_dir.name) # @todo move this step to a more universal place # Copy the config file over config_source = os.path.join(working_dir, "data", "configs", config_file)