(
returncode: Optional[int], pytester: Pytester
)
| 64 | |
| 65 | @pytest.mark.parametrize("returncode", (None, 42)) |
| 66 | def test_wrap_session_exit_sessionfinish( |
| 67 | returncode: Optional[int], pytester: Pytester |
| 68 | ) -> None: |
| 69 | pytester.makeconftest( |
| 70 | """ |
| 71 | import pytest |
| 72 | def pytest_sessionfinish(): |
| 73 | pytest.exit(reason="exit_pytest_sessionfinish", returncode={returncode}) |
| 74 | """.format( |
| 75 | returncode=returncode |
| 76 | ) |
| 77 | ) |
| 78 | result = pytester.runpytest() |
| 79 | if returncode: |
| 80 | assert result.ret == returncode |
| 81 | else: |
| 82 | assert result.ret == ExitCode.NO_TESTS_COLLECTED |
| 83 | assert result.stdout.lines[-1] == "collected 0 items" |
| 84 | assert result.stderr.lines == ["Exit: exit_pytest_sessionfinish"] |
| 85 | |
| 86 | |
| 87 | @pytest.mark.parametrize("basetemp", ["foo", "foo/bar"]) |
nothing calls this directly
no test coverage detected