mirror of
https://gitlab.com/MoonTestUse1/AdministrationItDepartmens.git
synced 2025-08-14 00:25:46 +02:00
Fix database
This commit is contained in:
@@ -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/**/*
|
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user