Skip to content

Commit a801b74

Browse files
committed
adding additional tests
1 parent 275ff17 commit a801b74

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/console/commands/test_check.py

+33
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,39 @@ def test_check_private(
113113
assert tester.io.fetch_output() == expected
114114

115115

116+
@pytest.mark.parametrize(
117+
("options", "expected", "expected_status"),
118+
[
119+
("", "All set!\n", 0),
120+
("--lock", "Error: poetry.lock was not found.\n", 1),
121+
],
122+
)
123+
def test_check_lock_missing(
124+
mocker: MockerFixture,
125+
tester: CommandTester,
126+
fixture_dir: FixtureDirGetter,
127+
options: str,
128+
expected: str,
129+
expected_status: int,
130+
) -> None:
131+
from poetry.toml import TOMLFile
132+
133+
mocker.patch(
134+
"poetry.poetry.Poetry.file",
135+
return_value=TOMLFile(fixture_dir("private_pyproject") / "pyproject.toml"),
136+
new_callable=mocker.PropertyMock,
137+
)
138+
139+
status_code = tester.execute(options)
140+
141+
assert status_code == expected_status
142+
143+
if status_code == 0:
144+
assert tester.io.fetch_output() == expected
145+
else:
146+
assert tester.io.fetch_error() == expected
147+
148+
116149
@pytest.mark.parametrize("options", ["", "--lock"])
117150
def test_check_lock_outdated(
118151
command_tester_factory: CommandTesterFactory,

0 commit comments

Comments
 (0)