Skip to content

Commit

Permalink
typed conftest properly
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Sep 16, 2024
1 parent 2ebadcf commit 55b0fe3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import logging
from pathlib import Path
import typing as ty
import tempfile
import pytest

Expand All @@ -23,15 +24,16 @@
if os.getenv("_PYTEST_RAISE", "0") != "0":

@pytest.hookimpl(tryfirst=True)
def pytest_exception_interact(call):
raise call.excinfo.value
def pytest_exception_interact(call: pytest.CallInfo[ty.Any]) -> None:
if call.excinfo is not None:
raise call.excinfo.value

@pytest.hookimpl(tryfirst=True)
def pytest_internalerror(excinfo):
def pytest_internalerror(excinfo: pytest.ExceptionInfo[BaseException]) -> None:
raise excinfo.value


@pytest.fixture
def work_dir():
def work_dir() -> Path:
work_dir = tempfile.mkdtemp()
return Path(work_dir)

0 comments on commit 55b0fe3

Please sign in to comment.