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
services:
- name: postgres:15
alias: postgres
variables:
POSTGRES_DB: test_app
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/test_app
POSTGRES_HOST: postgres
TESTING: "1"
PYTHONPATH: "${CI_PROJECT_DIR}/backend"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.pip-cache"
PYTHONPATH: "$CI_PROJECT_DIR/backend"
cache:
paths:
- .pip-cache/
- venv/
stages:
- 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:
stage: test
before_script:
- python -V
- python -m venv venv
- source venv/bin/activate
- cd backend
- pip install -r requirements.txt
script:
- python -m pytest -v --cov=app --cov-report=xml --timeout=30 -n auto
timeout: 5 minutes
coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: backend/coverage.xml
path: coverage.xml
when: always
paths:
- 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.db.base import Base
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.utils.security import get_password_hash