Skip to content

fixed test

fixed test #29

Workflow file for this run

name: CI Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DB: validation
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# - name: Connect to PostgreSQL
# run: |
# python3 -m src.setup_database
# env:
# POSTGRES_HOST: localhost
# POSTGRES_PORT: 5432
- name: Run tests
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: validation
run: |
SERVER_LOG=$(mktemp)
coverage run -m src.main >& $SERVER_LOG &
serverPID=$!
sleep 3
pytest tests/
kill $serverPID
cat $SERVER_LOG
sleep 3
- name: Generate coverage report
run: |
coverage report -m
- name: Run pylint
run: |
find src -type f -name "*.py" | egrep -v ".git/*" | xargs pylint --fail-under=8