Skip to content

Commit

Permalink
change: split coverage out from testenv in tox.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Krishna authored and akrishna1995 committed Mar 13, 2024
1 parent 5828ad4 commit e2cedec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Before sending us a pull request, please ensure that:
1. Install coverage using `pip install .[test]`
1. cd into the sagemaker-python-sdk folder: `cd sagemaker-python-sdk` or `cd /environment/sagemaker-python-sdk`
1. Run the following tox command and verify that all code checks and unit tests pass: `tox tests/unit`

You can also run a single test with the following command: `tox -e py310 -- -s -vv <path_to_file><file_name>::<test_function_name>`
1. You can also run a single test with the following command: `tox -e py310 -- -s -vv <path_to_file><file_name>::<test_function_name>`
1. You can run coverage via runcvoerage env : `tox -e runcoverage -- tests/unit` or `tox -e py310 -- tests/unit --cov=sagemaker --cov-append --cov-report xml`
* Note that the coverage test will fail if you only run a single test, so make sure to surround the command with `export IGNORE_COVERAGE=-` and `unset IGNORE_COVERAGE`
* Example: `export IGNORE_COVERAGE=- ; tox -e py310 -- -s -vv tests/unit/test_estimator.py::test_sagemaker_model_s3_uri_invalid ; unset IGNORE_COVERAGE`

Expand Down
9 changes: 7 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,17 @@ commands =
pip install 'torchvision==0.15.2+cpu' -f 'https://download.pytorch.org/whl/torch_stable.html'
pip install 'dill>=0.3.8'

pytest --cov=sagemaker --cov-append {posargs}
{env:IGNORE_COVERAGE:} coverage report -i --fail-under=86
pytest {posargs}
deps = .[test]
depends =
{py38,py39,py310,p311}: clean

[testenv:runcoverage]
description = run unit tests with coverage
commands =
pytest --cov=sagemaker --cov-append {posargs}
{env:IGNORE_COVERAGE:} coverage report -i --fail-under=86

[testenv:flake8]
skipdist = true
skip_install = true
Expand Down

0 comments on commit e2cedec

Please sign in to comment.