Skip to content

Commit

Permalink
stage: fix --dry-run (#3799)
Browse files Browse the repository at this point in the history
* tests: unit: move stage tests into a separate dir

* stage: fix --dry-run

Part of #3777
  • Loading branch information
efiop authored May 14, 2020
1 parent 1676a7a commit ff4fcc9
Show file tree
Hide file tree
Showing 3 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"]
File renamed without changes.

0 comments on commit ff4fcc9

Please sign in to comment.