mirror of
https://github.com/dartdavros/chatballs.git
synced 2026-10-05 09:14:58 +03:00
✅ test(infra): make pytest discover the suite and unify the test command (#3)
- add apps/backend/pytest.ini (next to manage.py so it works inside the backend container); include tests.py in python_files so pytest collects the existing Django TestCase suites (was silently collecting nothing) - drop the duplicate pytest config from the root pyproject.toml - scripts/check.ps1 runs pytest + frontend unit tests + typechecks - document the canonical test commands (backend/frontend/e2e) in README Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
19a592b05c
commit
9679cb8cfc
4 files changed
+36
-6
No files matched your search
@@ -34,3 +34,32 @@ Create or refresh the local OWNER account:
|
||||
```powershell
|
||||
docker compose run --rm backend python manage.py bootstrap_owner --email owner@edevs.tech --password local-owner-password --name "Иван Петров"
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
All suites run in Docker, so no manual environment is required — the test
|
||||
runners auto-detect themselves and relax production hardening (secret-key
|
||||
fail-fast, SSL redirect, throttling) for the duration of the run.
|
||||
|
||||
Run everything (backend tests, frontend unit tests, typechecks):
|
||||
|
||||
```powershell
|
||||
.\scripts\check.ps1
|
||||
```
|
||||
|
||||
Individual suites:
|
||||
|
||||
```powershell
|
||||
# Backend (pytest + pytest-django)
|
||||
docker compose run --rm backend pytest
|
||||
|
||||
# Frontend unit tests (vitest)
|
||||
docker compose run --rm internal-ui npm run test
|
||||
|
||||
# End-to-end (Playwright, internal-ui) — auto-starts the dev server
|
||||
npx playwright install chromium # one-time
|
||||
npx playwright test --project=internal-ui
|
||||
```
|
||||
|
||||
Backend pytest configuration lives in `apps/backend/pytest.ini` (it must sit
|
||||
next to `manage.py` so it is also visible inside the backend container).
|
||||
@@ -0,0 +1,3 @@
|
||||
[pytest]
|
||||
DJANGO_SETTINGS_MODULE = hub_backend.settings
|
||||
python_files = tests.py test_*.py *_tests.py
|
||||
+2
-5
@@ -7,11 +7,8 @@ src = ["apps/backend"]
|
||||
select = ["E", "F", "I", "UP", "B", "DJ"]
|
||||
ignore = ["DJ001"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
DJANGO_SETTINGS_MODULE = "hub_backend.settings"
|
||||
pythonpath = ["apps/backend"]
|
||||
testpaths = ["apps/backend"]
|
||||
python_files = ["test_*.py", "*_tests.py"]
|
||||
# pytest config lives in apps/backend/pytest.ini so it is also picked up inside
|
||||
# the backend container (workdir /app/apps/backend, which does not mount this file).
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.12"
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
docker compose run --rm backend python manage.py test
|
||||
docker compose run --rm backend pytest
|
||||
docker compose run --rm internal-ui npm run test
|
||||
docker compose run --rm internal-ui npm run typecheck
|
||||
docker compose run --rm checkout npm run typecheck
|
||||
docker compose run --rm web-chat npm run typecheck
|
||||
Reference in new issue
Block a user