Skip to content

Commit f2f70de

Browse files
test: cover module entrypoint (#10883)
1 parent ffcacc9 commit f2f70de

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/test_main.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from __future__ import annotations
2+
3+
import runpy
4+
5+
from typing import TYPE_CHECKING
6+
7+
import pytest
8+
9+
10+
if TYPE_CHECKING:
11+
from pytest_mock import MockerFixture
12+
13+
14+
def test_module_entrypoint_exits_with_application_status(mocker: MockerFixture) -> None:
15+
main_mock = mocker.patch("poetry.console.application.main", side_effect=lambda: 17)
16+
17+
with pytest.raises(SystemExit) as e:
18+
runpy.run_module("poetry", run_name="__main__")
19+
20+
assert e.value.code == 17
21+
assert main_mock.call_count == 1

0 commit comments

Comments
 (0)