tests/test_ext_autodoc/conftest.py
raw| 1 | from __future__ import annotations |
| 2 | |
| 3 | import sys |
| 4 | |
| 5 | import pytest |
| 6 | |
| 7 | from tests.utils import TEST_ROOTS_DIR |
| 8 | |
| 9 | TYPE_CHECKING = False |
| 10 | if TYPE_CHECKING: |
| 11 | from collections.abc import Iterator |
| 12 | |
| 13 | |
| 14 | @pytest.fixture(scope='module') |
| 15 | def inject_autodoc_root_into_sys_path() -> Iterator[None]: |
| 16 | autodoc_root_path = str(TEST_ROOTS_DIR / 'test-ext-autodoc') |
| 17 | |
| 18 | sys.path.insert(0, autodoc_root_path) |
| 19 | yield |
| 20 | sys.path[:] = [p for p in sys.path if p != autodoc_root_path] |