Skip to content

Commit

Permalink
stage: fix --dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed May 14, 2020
1 parent 8c1270a commit 0fade54
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions dvc/stage/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def cmd_run(stage, *args, **kwargs):

def run_stage(stage, dry=False, force=False, run_cache=False):
if dry:
logger.info("Running command:\n\t{}".format(stage.cmd))
return
stage_cache = stage.repo.stage_cache
stage_cached = (
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/stage/test_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import logging

from dvc.stage import Stage
from dvc.stage.run import run_stage


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"]

0 comments on commit 0fade54

Please sign in to comment.