Skip to content

Commit def55ba

Browse files
Fix -i -1 test
1 parent 0b8bff5 commit def55ba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

codespell_lib/tests/test_basic.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pathlib import Path
1010
from shutil import copyfile
1111
from typing import Any, Generator, Optional, Tuple, Union
12+
from unittest import mock
1213

1314
import pytest
1415

@@ -237,7 +238,11 @@ def test_interactivity(
237238
try:
238239
assert cs.main(fname) == 0, "empty file"
239240
fname.write_text("abandonned\n")
240-
assert cs.main("-i", "-1", fname) == 1, "bad"
241+
with mock.patch.object(sys, 'argv', ("-i", "-1", fname)):
242+
with pytest.raises(SystemExit) as e:
243+
cs.main("-i", "-1", fname)
244+
assert e.type == SystemExit
245+
assert e.value.code != 0
241246
with FakeStdin("y\n"):
242247
assert cs.main("-i", "3", fname) == 1
243248
with FakeStdin("n\n"):

0 commit comments

Comments
 (0)