32 lines
783 B
Python
32 lines
783 B
Python
"""pytest configuration for integration tests.
|
|
|
|
Integration tests require a live PostgreSQL server at the configured host.
|
|
They are skipped automatically if the server is unreachable.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pathlib
|
|
|
|
import pytest
|
|
|
|
|
|
def pytest_ignore_collect(
|
|
collection_path: pathlib.Path, config: pytest.Config
|
|
) -> bool:
|
|
"""Skip integration tests unless --integration is passed."""
|
|
if "integration" in str(collection_path) and not config.getoption(
|
|
"--integration", False
|
|
):
|
|
return True
|
|
return False
|
|
|
|
|
|
def pytest_addoption(parser: pytest.Parser) -> None:
|
|
parser.addoption(
|
|
"--integration",
|
|
action="store_true",
|
|
default=False,
|
|
help="Run integration tests (requires PostgreSQL)",
|
|
)
|