Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,17 @@ ignore = ["ANN101", "ANN102", "ANN401"]
[tool.ruff.isort]
known-first-party = ["rulebook_ai"]

[tool.pytest]
[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["src"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"unit: marks tests as unit tests",
"integration: marks tests as integration tests",
]
addopts = "-v"
addopts = ["-v"]

[tool.mypy]
python_version = "3.9"
Expand Down
30 changes: 30 additions & 0 deletions tests/unit/test_pytest_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Regression tests for pytest configuration."""

import subprocess
import sys
from pathlib import Path


def test_pytest_config_supports_collect_only_from_repo_root() -> None:
"""The pyproject pytest config should not fail during argument parsing."""
repo_root = Path(__file__).resolve().parents[2]

result = subprocess.run( # noqa: S603
[
sys.executable,
"-m",
"pytest",
"--collect-only",
"tests/unit/test_state_files.py",
"-q",
],
cwd=repo_root,
capture_output=True,
text=True,
timeout=30,
)

if result.returncode != 0:
raise AssertionError(result.stderr)
if "test_state_files.py" not in result.stdout:
raise AssertionError(result.stdout)