Skip to content

Commit c44d6ff

Browse files
committed
test: Cover run() in dry-run mode
1 parent 27bc6d6 commit c44d6ff

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/test_staged_script.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,18 @@ def test_run_override_print_commands(
223223
assert f"Executing: {command}" in captured.out
224224

225225

226+
def test_run_dry_run(
227+
script: StagedScript, capsys: pytest.CaptureFixture
228+
) -> None:
229+
"""Test the :func:`run` method in dry-run mode."""
230+
command = "echo 'dry-run mode'"
231+
script.dry_run = True
232+
script.run(command)
233+
captured = capsys.readouterr()
234+
for _ in ["The command executed would be", command]:
235+
assert _ in captured.out
236+
237+
226238
@pytest.mark.parametrize("script_success", [True, False])
227239
@pytest.mark.parametrize(
228240
"extras",

0 commit comments

Comments
 (0)