def test_asdf_roundtrip_pipeline(_jail): """Save a Pipeline pars and re-instantiate with the save parameters""" # Save the parameters par_path = 'mkp_pars.asdf' args = [ 'jwst.stpipe.tests.steps.MakeListPipeline', 'a.fits', 'b', '--steps.make_list.par1', '10.', '--steps.make_list.par2', 'par2', '--save-parameters', par_path ] Step.from_cmdline(args) # Rerun with the parameter file # Initial condition is that `Step.from_cmdline` # succeeds. args = [ par_path, 'a.fits', 'b' ] step = Step.from_cmdline(args) # As a secondary condition, ensure the required parameter # `par2` is set. assert step.make_list.par2 == 'par2'
def test_step_from_asdf(): """Test initializing step completely from config""" config_file = t_path( Path('steps') / 'jwst_generic_pars-makeliststep_0001.asdf') step = Step.from_config_file(config_file) assert isinstance(step, MakeListStep) assert step.name == 'make_list' results = step.run() assert results == DEFAULT_RESULT
def test_step_from_asdf_noname(): """Test initializing step completely from config without a name specified""" root = 'jwst_generic_pars-makeliststep_0002' config_file = t_path(Path('steps') / (root + '.asdf')) step = Step.from_config_file(config_file) assert isinstance(step, MakeListStep) assert step.name == root results = step.run() assert results == DEFAULT_RESULT
def test_from_command_line_override(): """Test creating Step from command line using ASDF""" config_file = t_path( Path('steps') / 'jwst_generic_pars-makeliststep_0001.asdf') args = [config_file, '--par1=0.'] step = Step.from_cmdline(args) assert isinstance(step, MakeListStep) assert step.par1 == 0. assert step.par2 == 'Yes, a string' results = step.run() assert results == [0., DEFAULT_PAR2, False]