def test_run_stage_dry(caplog): with caplog.at_level(level=logging.INFO, logger="dvc"): stage = Stage(None, "stage.dvc", cmd="mycmd arg1 arg2") run_stage(stage, dry=True) assert caplog.messages == [ "Running callback stage 'stage.dvc':", ]
def test_run_stage_dry(caplog, cmd, expected): with caplog.at_level(level=logging.INFO, logger="dvc"): stage = Stage(None, "stage.dvc", cmd=cmd) run_stage(stage, dry=True) expected.insert(0, "Running stage 'stage.dvc':") assert caplog.messages == expected
def test_stage_run_checkpoint(tmp_dir, dvc, mocker, checkpoint): stage = Stage(dvc, "stage.dvc", cmd="mycmd arg1 arg2") mocker.patch.object(stage, "save") mock_cmd_run = mocker.patch("dvc.stage.run.cmd_run") if checkpoint: callback = mocker.Mock() else: callback = None run_stage(stage, checkpoint_func=callback) mock_cmd_run.assert_called_with(stage, checkpoint_func=callback)
def test_run_stage_dry(caplog): with caplog.at_level(level=logging.INFO, logger="dvc"): run_stage(Stage(None, cmd="mycmd arg1 arg2"), dry=True) assert caplog.messages == ["Running command:\n\tmycmd arg1 arg2"]