Skip to content

Commit

Permalink
Fix -i -1 test
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Jun 2, 2024
1 parent 0b8bff5 commit def55ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion codespell_lib/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pathlib import Path
from shutil import copyfile
from typing import Any, Generator, Optional, Tuple, Union
from unittest import mock

import pytest

Expand Down Expand Up @@ -237,7 +238,11 @@ def test_interactivity(
try:
assert cs.main(fname) == 0, "empty file"
fname.write_text("abandonned\n")
assert cs.main("-i", "-1", fname) == 1, "bad"
with mock.patch.object(sys, 'argv', ("-i", "-1", fname)):
with pytest.raises(SystemExit) as e:
cs.main("-i", "-1", fname)
assert e.type == SystemExit
assert e.value.code != 0
with FakeStdin("y\n"):
assert cs.main("-i", "3", fname) == 1
with FakeStdin("n\n"):
Expand Down

0 comments on commit def55ba

Please sign in to comment.