feat: add pyproject.toml, dev dependencies, first unit test
This commit is contained in:
@@ -8,28 +8,27 @@ on:
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: python:3.12
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: pip install ruff
|
||||
- run: ruff check src/api/
|
||||
- run: pip install -e ".[dev]"
|
||||
- run: ruff check src/
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: python:3.12
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: pip install -r src/api/requirements.txt
|
||||
- run: pip install pytest
|
||||
- run: pytest tests/ -v
|
||||
- run: pip install -e ".[dev]"
|
||||
- run: pytest tests/
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: python:3.12
|
||||
needs: [lint, test]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- run: docker build -t enduro-trails:ci .
|
||||
- run: docker build .
|
||||
|
||||
37
pyproject.toml
Normal file
37
pyproject.toml
Normal file
@@ -0,0 +1,37 @@
|
||||
[project]
|
||||
name = "enduro-trails"
|
||||
version = "0.1.0"
|
||||
requires-python = ">=3.12"
|
||||
description = "Карта эндуро-маршрутов с рельефом, навигацией и слоями terrain/TRI/hillshade"
|
||||
readme = "README.md"
|
||||
dependencies = [
|
||||
"fastapi==0.111.0",
|
||||
"uvicorn==0.29.0",
|
||||
"shapely==2.0.4",
|
||||
"mapbox-vector-tile==2.2.0",
|
||||
"httpx==0.27.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"ruff>=0.4.0",
|
||||
"pytest>=8.0",
|
||||
"httpx>=0.27",
|
||||
"pytest-asyncio>=0.23",
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=68", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
where = ["."]
|
||||
include = ["src*"]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py312"
|
||||
line-length = 120
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
testpaths = ["tests"]
|
||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
0
tests/unit/__init__.py
Normal file
0
tests/unit/__init__.py
Normal file
13
tests/unit/test_health.py
Normal file
13
tests/unit/test_health.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
from httpx import AsyncClient, ASGITransport
|
||||
from src.api.main import app
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_health_endpoint():
|
||||
transport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as client:
|
||||
resp = await client.get("/api/health")
|
||||
assert resp.status_code == 200
|
||||
data = resp.json()
|
||||
assert data["status"] == "ok"
|
||||
Reference in New Issue
Block a user