Skip to content
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Install dependencies
run: |
uv sync --dev
uv sync --extra dev

- name: Check code formatting with black
run: |
Expand Down Expand Up @@ -67,12 +67,12 @@ jobs:

- name: Install dependencies
run: |
uv sync --dev
uv sync --extra dev

- name: Run tests with pytest
run: |
if [ -d "tests" ] && [ "$(ls -A tests 2>/dev/null)" ]; then
uv run pytest tests/ -v
uv run pytest tests/ -v --cov=github_pm --cov-report=term
else
echo "No tests directory or tests found, skipping pytest"
fi
Expand Down
55 changes: 54 additions & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ github_pm = "github_pm.cli:main"
dev = [
"black>=24.4.2",
"flake8>=7.3.0",
"httpx>=0.27.0",
"isort>=6.0.1",
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"pytest-cov>=5.0.0",
"tox>=4.23.2",
]

Expand All @@ -62,7 +65,7 @@ order_by_type = false

[tool.tox]
requires = ["tox>=4.23.2"]
env_list = ["format", "isort", "lint"]
env_list = ["format", "isort", "lint", "test", "coverage"]

[tool.tox.env.format]
description = "check code format"
Expand All @@ -81,3 +84,53 @@ description = "check code"
skip_install = true
deps = ["flake8"]
commands = [["flake8", { replace = "posargs", default = ["src", "tests"], extend = true}]]

[tool.tox.env.test]
description = "run tests"
deps = ["pytest>=8.0.0", "pytest-asyncio>=0.23.0", "httpx>=0.27.0"]
commands = [["pytest", { replace = "posargs", default = ["tests"], extend = true}]]

[tool.tox.env.coverage]
description = "run tests with coverage"
deps = ["pytest>=8.0.0", "pytest-asyncio>=0.23.0", "pytest-cov>=5.0.0", "httpx>=0.27.0"]
commands = [
["pytest", "--cov=github_pm", "--cov-report=term-missing", "--cov-report=html", { replace = "posargs", default = ["tests"], extend = true}],
]

[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]

[tool.coverage.run]
source = ["src"]
omit = [
"*/tests/*",
"*/test_*.py",
"*/__pycache__/*",
"*/__init__.py",
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"@abstractmethod",
"@abstractproperty",
"if False:",
"if 0:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
show_missing = true
precision = 2
skip_covered = false

[tool.coverage.html]
directory = "htmlcov"
13 changes: 13 additions & 0 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Pytest configuration and fixtures.

ai-generated: Cursor
"""

from pathlib import Path
import sys

# Add src directory to Python path for imports
backend_dir = Path(__file__).parent.parent
src_dir = backend_dir / "src"
if str(src_dir) not in sys.path:
sys.path.insert(0, str(src_dir))
Loading
Loading