diff --git a/src/stpipe/step.py b/src/stpipe/step.py index 8b216b1e..7e2c3c9e 100644 --- a/src/stpipe/step.py +++ b/src/stpipe/step.py @@ -485,15 +485,21 @@ def run(self, *args, **kwargs): self.log.info("Step %s running with args %s.", self.name, args) # Check for explicit disable for CRDS parameters - if 'disable_crds_steppars' in kwargs: + if "disable_crds_steppars" in kwargs: disable_crds_steppars = kwargs.pop("disable_crds_steppars") else: disable_crds_steppars = True if self.parent is None and self._validate_kwds: - self.log.warning("CRDS parameter checks are currently disabled by default.") - self.log.warning("In future builds, they will be enabled by default.") - self.log.warning("To turn them on now, set 'disable_crds_steppars' to False " - "in the arguments to 'run'.") + self.log.warning( + "CRDS parameter checks are currently disabled by default." + ) + self.log.warning( + "In future builds, they will be enabled by default." + ) + self.log.warning( + "To turn them on now, set 'disable_crds_steppars' to False " + "in the arguments to 'run'." + ) # Get parameters from user parameters = None @@ -520,8 +526,10 @@ def run(self, *args, **kwargs): # Catch steps that cannot build a config # (e.g. post hooks created from local functions, # missing input files) - raise ValueError(f"Cannot retrieve CRDS keywords for " - f"{self.name} with input {str(filename)}.") + raise ValueError( + f"Cannot retrieve CRDS keywords for " + f"{self.name} with input {str(filename)}." + ) # Update parameters from the retrieved config + keywords if parameters: @@ -631,7 +639,9 @@ def run(self, *args, **kwargs): # Run the post hooks for post_hook in self._post_hooks: - hook_results = post_hook.run(step_result, disable_crds_steppars=True) + hook_results = post_hook.run( + step_result, disable_crds_steppars=True + ) if hook_results is not None: step_result = hook_results diff --git a/tests/test_step.py b/tests/test_step.py index d043d5d8..362f2fbc 100644 --- a/tests/test_step.py +++ b/tests/test_step.py @@ -522,7 +522,7 @@ def test_step_run_crds_error(caplog, step_class): # Call run with an incomplete step implementation, on a file that does # not exist, without mocking the CRDS retrieval - with pytest.raises(ValueError, match='Cannot retrieve CRDS keywords'): + with pytest.raises(ValueError, match="Cannot retrieve CRDS keywords"): step.run("science.fits", disable_crds_steppars=False) @@ -644,8 +644,11 @@ def test_pipe_run_step_values_from_keywords(): assert pipe.step1._initialized["str1"] is False # Parameters are set by user - pipe.run("science.fits", steps={"step1": {"str1": "from keywords"}}, - disable_crds_steppars=False) + pipe.run( + "science.fits", + steps={"step1": {"str1": "from keywords"}}, + disable_crds_steppars=False, + ) assert pipe.step1.str1 == "from keywords" assert pipe.step1._initialized["str1"] is True