diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6821505..b497ad2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,9 @@ name: Test on: push: - branches: [ develop, main ] + branches: [ dev, main ] pull_request: - branches: [ develop, main ] + branches: [ dev, main ] jobs: build: @@ -25,9 +25,14 @@ jobs: run: | python3 -m pip install --upgrade pip python3 -m pip install pytest + python3 -m pip install pytest-cov python3 -m pip install .[tests] - name: Tests run: | - pytest - shell: bash \ No newline at end of file + pytest --cov=cst_python --cov-report json + shell: bash + + - name: Coverage Check + run: | + python3 tests/check_coverage.py \ No newline at end of file diff --git a/.gitignore b/.gitignore index efa407c..d5e6f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +coverage.json + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/tests/check_coverage.py b/tests/check_coverage.py new file mode 100644 index 0000000..044a576 --- /dev/null +++ b/tests/check_coverage.py @@ -0,0 +1,8 @@ +import json + +if __name__ == "__main__": + + with open("coverage.json") as file: + coverage_info = json.load(file) + + assert coverage_info["totals"]["percent_covered"] > 78 \ No newline at end of file