Skip to content

Commit

Permalink
add test for warning
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Oct 11, 2024
1 parent ab20bc5 commit 61bd710
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import stpipe.config_parser as cp
from stpipe import cmdline
from stpipe.pipeline import Pipeline
from stpipe.step import Step
from stpipe.step import NoCRDSParametersWarning, Step


# ######################
Expand All @@ -27,6 +27,9 @@ class SimpleStep(Step):
output_ext = string(default='simplestep')
"""

def process(self, *args):
return args


class SimplePipe(Pipeline):
"""A Pipeline with parameters and one step"""
Expand All @@ -41,6 +44,9 @@ class SimplePipe(Pipeline):

step_defs: ClassVar = {"step1": SimpleStep}

def process(self, *args):
return args


class LoggingPipeline(Pipeline):
"""A Pipeline that utilizes self.log
Expand Down Expand Up @@ -411,3 +417,11 @@ def test_log_records():
pipeline.run()

assert any(r == "This step has called out a warning." for r in pipeline.log_records)


@pytest.mark.parametrize("StepClass", (SimpleStep, SimplePipe))
def test_warning_for_missing_crds_pars(StepClass):
s = StepClass()
s._warn_on_missing_crds_steppars = True
with pytest.warns(NoCRDSParametersWarning):
s.run()

0 comments on commit 61bd710

Please sign in to comment.