TASK-17: Add backend test suite with pytest - #24
Open
z4ab wants to merge 8 commits into
Open
Conversation
- pytest config with asyncio_mode=auto - conftest with session-scoped DB pool, per-test table truncation, seed data fixture, and ASGI httpx client - test_queries.py: unit tests for haversine, bounding box, zoom-to-grid - test_api.py: integration tests for all API endpoints (health, projects, submit, stats) - db/setup_test_db.sh script to create test database - db/Makefile with test-db target - Test dependencies added to requirements.txt
z4ab
force-pushed
the
task-17-backend-tests
branch
from
June 17, 2026 02:12
90c4a4c to
0e7a857
Compare
- Add repo root to sys.path in conftest.py so backend module resolves - Run ruff format on pipeline/status_inference.py - Move MapView helper functions outside component to fix lint rules - Replace 'as any' casts with proper types in MapView
_SCHEMA_PATH was computing path relative to conftest.py but only going 2 dirs up (to backend/) instead of 3 (to repo root). Now uses _REPO_ROOT which is already correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #20
What
Adds a comprehensive pytest test suite for the backend: unit tests for utility functions and integration tests for all API endpoints.
Changes
backend/pytest.iniasyncio_mode = autobackend/tests/conftest.pybackend/tests/test_queries.pybackend/tests/test_api.pybackend/requirements.txtpytest,pytest-asyncio,asgi-lifespandb/setup_test_db.shconstructnear_testdatabasedb/Makefiletest-dbtargetHow to Run
Or with custom DB URL:
Test Coverage
Unit tests (18):
Integration tests (17):
Verification
ruff check .— passesruff format --check .— passes