| 1 | """Fixtures for integration tests.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import re |
| 6 | |
| 7 | import pytest |
| 8 | import typer |
| 9 | import typer.testing |
| 10 | |
| 11 | from rstcheck import _cli |
| 12 | |
| 13 | ERROR_CODE_REGEX = re.compile(r"\([A-Z]*?/\d\)") |
| 14 | |
| 15 | |
| 16 | @pytest.fixture(name="cli_app") |
| 17 | def cli_app_fixture() -> typer.Typer: |
| 18 | """Create typer app from ``cli`` function for testing.""" |
| 19 | return _cli.app |
| 20 | |
| 21 | |
| 22 | @pytest.fixture(name="cli_runner") |
| 23 | def cli_runner_fixture() -> typer.testing.CliRunner: |
| 24 | """Create CLI Test Runner.""" |
| 25 | return typer.testing.CliRunner(mix_stderr=True) |