Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: coverage report #305

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.cfg.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools tox tox-gh-actions
python -m pip install --upgrade pip setuptools pytest pytest-cov
python -m pip install .[tests]

- uses: dawidd6/action-download-artifact@v3
with:
Expand Down Expand Up @@ -101,8 +103,9 @@ jobs:
FSGATEWAY_TAG=latest-dev JMS_TAG=latest-dev LOCALHOST_ADDR=localhost docker-compose up -d
working-directory: ./docker-compose-artifact

- name: Test with tox
run: tox -e ${{ matrix.cfg.toxenv }}-coverage
- name: "Run pytest"
run: |
coverage run -m pytest -ra -s --durations=0 -p pytest_cov --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term --junitxml test_results-py310-coverage.xml -vv --cov-append
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RobPasMue @klmcadams I think here you're still mixing running with coverage and the pytest-cov plugin.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to edit the PR @FedericoNegri - pytest-cov should just be a wrapper on top of coverage

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, @klmcadams get in sync with @FedericoNegri and give it a try to the way he is running it locally to report 92%. It's the first time I see this behaviour...

env:
HPS_TEST_URL: https://localhost:8443/rep
HPS_TEST_USERNAME: repadmin
Expand Down
22 changes: 7 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ version = "0.7.dev0"
description = "A python client for Ansys HPC Platform Services"
readme = "README.rst"
requires-python = ">=3.9,<4.0"
license = {file = "LICENSE"}
authors = [
{name = "ANSYS, Inc.", email = "[email protected]"},
]
maintainers = [
{name = "ANSYS, Inc.", email = "[email protected]"},
]
license = { file = "LICENSE" }
authors = [{ name = "ANSYS, Inc.", email = "[email protected]" }]
maintainers = [{ name = "ANSYS, Inc.", email = "[email protected]" }]

classifiers = [
"Development Status :: 4 - Beta",
Expand All @@ -40,10 +36,7 @@ dependencies = [
]

[project.optional-dependencies]
tests = [
"pytest==8.0.0",
"pytest-cov==4.1.0",
]
tests = ["pytest==8.0.0", "pytest-cov==4.1.0"]

doc = [
"ansys-sphinx-theme==0.13.2",
Expand All @@ -67,7 +60,7 @@ build = [
"build==1.0.3",
"twine==4.0.2",
"wheel",
"datamodel-code-generator==0.24.2"
"datamodel-code-generator==0.24.2",
]

[project.urls]
Expand Down Expand Up @@ -107,10 +100,9 @@ log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
addopts = """-ra -s --durations=0 -p pytest_cov --cov=ansys.hps --cov-report html:.cov/html \
--cov-report xml:.cov/xml --cov-report term -vv --cov-append"""
addopts = "-ra --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv"
filterwarnings = [
"ignore::urllib3.exceptions.InsecureRequestWarning",
"ignore::DeprecationWarning:pkg_resources.*",
"ignore::ansys.hps.client.UnverifiedHTTPSRequestsWarning",
]
]
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ basepython =
passenv = HPS_TEST_*
setenv =
PYTHONUNBUFFERED = yes
coverage: PYTEST_EXTRA_ARGS = -ra -s --durations=0 -p pytest_cov --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term
coverage: PYTEST_EXTRA_ARGS = -ra --cov=ansys.hps --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term
deps =
-e .[tests]
commands =
coverage run -m pytest {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv --cov-append}
pytest {env:PYTEST_EXTRA_ARGS:} --junitxml test_results-{envname}.xml {posargs:-vv}

[testenv:style]
description = Checks project code style
Expand Down
Loading