Merge pull request #782 from FozzieHi/unit-tests

Improve and refactor testing.
This commit is contained in:
Son Nguyen Kim 2022-02-04 10:51:44 +01:00 committed by GitHub
commit 68acfc986a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 4 deletions

View File

@ -65,7 +65,7 @@ jobs:
- name: Test with pytest
run: |
pytest --cov=. --cov-report=term:skip-covered --cov-report=html:htmlcov --cov-fail-under=60
pytest
- name: Archive code coverage results
uses: actions/upload-artifact@v2

10
coverage.ini Normal file
View File

@ -0,0 +1,10 @@
[run]
branch = True
source = .
[report]
fail_under = 55
omit =
app/fake_data.py
oauth_tester.py
skip_covered = True

5
pytest.ini Normal file
View File

@ -0,0 +1,5 @@
[pytest]
addopts =
--cov
--cov-config coverage.ini
--cov-report=html:htmlcov

View File

@ -16,4 +16,4 @@ env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic revision --autogenerate
# remove the db
docker rm -f sl-db
docker rm -f sl-db

View File

@ -5,8 +5,8 @@ docker rm -f sl-test-db
docker run -d --name sl-test-db -e POSTGRES_PASSWORD=test -e POSTGRES_USER=test -e POSTGRES_DB=test -p 15432:5432 postgres:13
# the time the DB container starts
sleep 5
sleep 3
poetry run pytest
docker rm -f sl-test-db
docker rm -f sl-test-db