Split "we use the config" and "we use no config" so pytest won't try to consume config_file as a fixture

This commit is contained in:
Micah Jerome Ellison 2023-02-20 13:07:58 -08:00
parent 931707b8ef
commit 5af1050d9d

View file

@ -83,15 +83,15 @@ def we_have_type_of_keyring(keyring_type):
return TestKeyring() return TestKeyring()
@given(parse('we use the config "{config_file}"'), target_fixture="config_path")
@given(parse("we use no config"), 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): def we_use_the_config(request, temp_dir, working_dir, config_file):
# Move into temp dir as cwd # Move into temp dir as cwd
os.chdir(temp_dir.name) os.chdir(temp_dir.name) # @todo move this step to a more universal place
if not config_file:
return os.path.join(temp_dir.name, "non_existing_config.yaml")
# Copy the config file over # Copy the config file over
config_source = os.path.join(working_dir, "data", "configs", config_file) config_source = os.path.join(working_dir, "data", "configs", config_file)