1
0
mirror of https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git synced 2025-08-14 00:25:46 +02:00

Fix database

This commit is contained in:
MoonTestUse1
2025-01-07 06:01:45 +06:00
parent 4dbe6f28d9
commit e9f17ab3fb
2 changed files with 21 additions and 23 deletions

View File

@@ -1,40 +1,38 @@
image: python:3.11 image: python:3.11
services:
- name: postgres:15
alias: postgres
variables: variables:
POSTGRES_DB: test_app PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
POSTGRES_USER: postgres PYTHONPATH: "$CI_PROJECT_DIR/backend"
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust cache:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/test_app paths:
POSTGRES_HOST: postgres - .pip-cache/
TESTING: "1" - venv/
PYTHONPATH: "${CI_PROJECT_DIR}/backend"
stages: stages:
- test - test
before_script:
- cd backend
- python -m pip install --upgrade pip
- pip install -r requirements.txt
- pip install pytest pytest-cov pytest-timeout pytest-xdist
test: test:
stage: test stage: test
before_script:
- python -V
- python -m venv venv
- source venv/bin/activate
- cd backend
- pip install -r requirements.txt
script: script:
- python -m pytest -v --cov=app --cov-report=xml --timeout=30 -n auto - python -m pytest -v --cov=app --cov-report=xml --timeout=30 -n auto
timeout: 5 minutes
coverage: '/TOTAL.+ ([0-9]{1,3}%)/' coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
artifacts: artifacts:
when: always
reports: reports:
coverage_report: coverage_report:
coverage_format: cobertura coverage_format: cobertura
path: backend/coverage.xml path: coverage.xml
when: always
paths: paths:
- backend/coverage.xml - backend/coverage.xml
- backend/.coverage - backend/.coverage
rules:
- if: $CI_COMMIT_BRANCH
exists:
- backend/**/*

View File

@@ -9,7 +9,7 @@ from sqlalchemy.pool import StaticPool
from app.core.config import settings from app.core.config import settings
from app.db.base import Base from app.db.base import Base
from app.main import app from app.main import app
from app.deps import get_db from app.dependencies import get_db
from app.models.employee import Employee from app.models.employee import Employee
from app.utils.security import get_password_hash from app.utils.security import get_password_hash