-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run/repro: show command on dry-run, add ">" to script output (#5041)
* run/repro: show command on dry-run, add ">" to script output This rollbacks the earlier commit to not show command during the dry-run, and also prepends ">" in the command script instead of "$" sign. * fix tests
- Loading branch information
Showing
5 changed files
with
96 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
import logging | ||
|
||
import pytest | ||
|
||
from dvc.stage import Stage | ||
from dvc.stage.run import run_stage | ||
|
||
|
||
def test_run_stage_dry(caplog): | ||
@pytest.mark.parametrize( | ||
"cmd, expected", | ||
[ | ||
("mycmd arg1 arg2", ["> mycmd arg1 arg2"]), | ||
(["mycmd1 arg1", "mycmd2 arg2"], ["> mycmd1 arg1", "> mycmd2 arg2"]), | ||
], | ||
) | ||
def test_run_stage_dry(caplog, cmd, expected): | ||
with caplog.at_level(level=logging.INFO, logger="dvc"): | ||
stage = Stage(None, "stage.dvc", cmd="mycmd arg1 arg2") | ||
stage = Stage(None, "stage.dvc", cmd=cmd) | ||
run_stage(stage, dry=True) | ||
assert caplog.messages == [ | ||
"Running callback stage 'stage.dvc':", | ||
] | ||
|
||
expected.insert( | ||
0, "Running callback stage 'stage.dvc':", | ||
) | ||
assert caplog.messages == expected |