From 8c1270a4c3828df7c53783bb7b299286103c8f34 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 14 May 2020 16:55:00 +0300 Subject: [PATCH 1/2] tests: unit: move stage tests into a separate dir --- tests/unit/{ => stage}/test_stage.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/unit/{ => stage}/test_stage.py (100%) diff --git a/tests/unit/test_stage.py b/tests/unit/stage/test_stage.py similarity index 100% rename from tests/unit/test_stage.py rename to tests/unit/stage/test_stage.py From 0fade5482b9b659e0ff753ae8aaa11b9b7429172 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 14 May 2020 17:00:54 +0300 Subject: [PATCH 2/2] stage: fix --dry-run Part of #3777 --- dvc/stage/run.py | 1 + tests/unit/stage/test_run.py | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/unit/stage/test_run.py diff --git a/dvc/stage/run.py b/dvc/stage/run.py index ec2db8845c..4e33f96dfd 100644 --- a/dvc/stage/run.py +++ b/dvc/stage/run.py @@ -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 = ( diff --git a/tests/unit/stage/test_run.py b/tests/unit/stage/test_run.py new file mode 100644 index 0000000000..b0595051a1 --- /dev/null +++ b/tests/unit/stage/test_run.py @@ -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"]