Skip to content

Commit

Permalink
Adjust coverage coveralls to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Jun 23, 2024
1 parent 89586c3 commit 42d8a5d
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 37 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:
run: make pytest
lint:
runs-on: ubuntu-22.04
environment: CI
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -71,11 +70,32 @@ jobs:
run: |
make flake8
make black
coveralls:
runs-on: ubuntu-22.04
environment: CI
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -U setuptools
sudo apt-get update -qq
sudo apt-get install -qq swig libxml2-dev libxmlsec1-dev
pip install --force-reinstall --no-binary lxml lxml
make install-req
make install-test
- name: Run coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
pip install coveralls
coverage run setup.py test
coverage report -m
coveralls
make coverage
make coveralls
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FLAKE8=flake8
PYTEST=pytest
COVERAGE=coverage
COVERAGE_CONFIG=tests/coverage.rc
COVERALLS=coveralls
MAIN_SOURCE=src/onelogin/saml2
DEMOS=demo-django demo-flask demo-tornado demo_pyramid
TESTS=tests/src/OneLogin/saml2_tests
Expand All @@ -19,8 +20,14 @@ install-lint:
$(PIP) install -e ".[lint]"

pytest:
$(COVERAGE) run --source $(MAIN_SOURCE) --rcfile=$(COVERAGE_CONFIG) -m pytest
$(COVERAGE) report -m --rcfile=$(COVERAGE_CONFIG)
$(pytest)

coverage:
$(COVERAGE) run -m $(PYTEST)
$(COVERAGE) report -m

coveralls:
$(COVERALLS)

black:
$(BLACK) $(SOURCES)
Expand Down
29 changes: 28 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Changelog = "https://github.com/SAML-Toolkits/python3-saml/blob/master/changelog

[project.optional-dependencies]
test = [
"coverage>=4.5.2",
"coverage[toml]>=4.5.2",
"pytest>=4.6",
]
lint = [
Expand Down Expand Up @@ -93,3 +93,30 @@ atomic = true
ignore_comments = true
skip_gitignore = true
src_paths = ['src']

[tool.coverage.run]
branch = true

[tool.coverage.paths]
source = [
"src/onelogin/saml2"
]

[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug",
"if debug",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:"
]
show_missing = true
ignore_errors = true


[tool.coverage.html]
directory = "coverage_html_report"
30 changes: 0 additions & 30 deletions tests/coverage.rc

This file was deleted.

0 comments on commit 42d8a5d

Please sign in to comment.