Merge pull request #782 from FozzieHi/unit-tests
Improve and refactor testing.
This commit is contained in:
commit
68acfc986a
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
@ -65,7 +65,7 @@ jobs:
|
||||||
|
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
run: |
|
run: |
|
||||||
pytest --cov=. --cov-report=term:skip-covered --cov-report=html:htmlcov --cov-fail-under=60
|
pytest
|
||||||
|
|
||||||
- name: Archive code coverage results
|
- name: Archive code coverage results
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
|
10
coverage.ini
Normal file
10
coverage.ini
Normal 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
5
pytest.ini
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[pytest]
|
||||||
|
addopts =
|
||||||
|
--cov
|
||||||
|
--cov-config coverage.ini
|
||||||
|
--cov-report=html:htmlcov
|
|
@ -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
|
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic revision --autogenerate
|
||||||
|
|
||||||
# remove the db
|
# remove the db
|
||||||
docker rm -f sl-db
|
docker rm -f sl-db
|
||||||
|
|
|
@ -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
|
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
|
# the time the DB container starts
|
||||||
sleep 5
|
sleep 3
|
||||||
|
|
||||||
poetry run pytest
|
poetry run pytest
|
||||||
|
|
||||||
docker rm -f sl-test-db
|
docker rm -f sl-test-db
|
||||||
|
|
Loading…
Reference in a new issue