Skip to content

Commit

Permalink
ConfigObj needs a string, but otherwise don't convert Path to str
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavies-st committed Feb 26, 2024
1 parent 11a20b6 commit 066cde2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/stpipe/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ def build_config(cls, input, **kwargs): # noqa: A002
if "config_file" in kwargs:
config_file = kwargs["config_file"]
del kwargs["config_file"]
config_from_file = config_parser.load_config_file(config_file)
config_from_file = config_parser.load_config_file(str(config_file))
config_parser.merge_config(config, config_from_file)
config_dir = os.path.dirname(config_file)
else:
Expand Down
8 changes: 6 additions & 2 deletions tests/test_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,13 @@ def test_step_list_args(config_file_list_arg_step):
correctly.
"""
config, returned_config_file = ListArgStep.build_config(
"science.fits", config_file=str(config_file_list_arg_step)
"science.fits", config_file=config_file_list_arg_step
)
assert returned_config_file == str(config_file_list_arg_step)
assert returned_config_file == config_file_list_arg_step

# Command line tests below need the config file path to be a string
returned_config_file = str(returned_config_file)

c, *_ = cmdline.just_the_step_from_cmdline(
[
"filename.fits",
Expand Down

0 comments on commit 066cde2

Please sign in to comment.