Skip to content

Commit

Permalink
Merge pull request #45 from uktrade/ci/code-coverage
Browse files Browse the repository at this point in the history
ci: report code coverage
  • Loading branch information
michalc committed Aug 12, 2023
2 parents d00e0d8 + 281d850 commit 1b98647
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
branch = True
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
# If changing how many times tests are run, must also change in codecov.yml
# to ensure test coverage is reported only after all tests have finished
python-version:
- "3.7.1"
- "3.8.0"
Expand Down Expand Up @@ -47,4 +49,5 @@ jobs:
run: "timeout 60 bash -c 'until echo > /dev/tcp/127.0.0.1/5432; do sleep 5; done'"
- name: "Test"
run: |
pytest
pytest --cov
- uses: codecov/codecov-action@v3
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# pg-force-execute

[![PyPI package](https://img.shields.io/pypi/v/pg-force-execute?label=PyPI%20package&color=%234c1)](https://pypi.org/project/pg-force-execute/) [![Test suite](https://img.shields.io/github/actions/workflow/status/uktrade/pg-force-execute/tests.yml?label=Test%20suite)](https://github.com/uktrade/pg-force-execute/actions/workflows/tests.yml) [![Code coverage](https://img.shields.io/codecov/c/github/uktrade/pg-force-execute?label=Code%20coverage)](https://app.codecov.io/gh/uktrade/pg-force-execute)

Context manager to run PostgreSQL queries with SQLAlchemy, terminating any other clients that continue to block it after a configurable delay.

Using this to wrap queries is somewhat of a last resort, but is useful in certain Extract Transform Load (ETL) pipeline contexts. For example, if it is more important to replace one table with another than to allow running queries on the table to complete, then this can be used to run the relevant `ALTER TABLE RENAME TO` query.
Expand Down
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
comment: false
codecov:
notify:
after_n_builds: 120
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ dev = [
"pytest>=7.2.1",
]
ci = [
"pytest==7.2.1",
"pytest",
"pytest-cov",
"coverage",
]
ci-psycopg2-sqlalchemy1 = [
"psycopg2==2.9.2",
Expand Down

0 comments on commit 1b98647

Please sign in to comment.