Skip to content

Commit 52bc246

Browse files
akrishna1995Ashwin Krishna
authored and
root
committed
change: split coverage out from testenv in tox.ini (aws#4495)
Co-authored-by: Ashwin Krishna <[email protected]>
1 parent 7612098 commit 52bc246

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ Before sending us a pull request, please ensure that:
7777
1. Install coverage using `pip install .[test]`
7878
1. cd into the sagemaker-python-sdk folder: `cd sagemaker-python-sdk` or `cd /environment/sagemaker-python-sdk`
7979
1. Run the following tox command and verify that all code checks and unit tests pass: `tox tests/unit`
80-
81-
You can also run a single test with the following command: `tox -e py310 -- -s -vv <path_to_file><file_name>::<test_function_name>`
80+
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>`
81+
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`
8282
* 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`
8383
* Example: `export IGNORE_COVERAGE=- ; tox -e py310 -- -s -vv tests/unit/test_estimator.py::test_sagemaker_model_s3_uri_invalid ; unset IGNORE_COVERAGE`
8484

tox.ini

+7-2
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@ commands =
8686
pip install 'torchvision==0.15.2+cpu' -f 'https://download.pytorch.org/whl/torch_stable.html'
8787
pip install 'dill>=0.3.8'
8888

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

94+
[testenv:runcoverage]
95+
description = run unit tests with coverage
96+
commands =
97+
pytest --cov=sagemaker --cov-append {posargs}
98+
{env:IGNORE_COVERAGE:} coverage report -i --fail-under=86
99+
95100
[testenv:flake8]
96101
skipdist = true
97102
skip_install = true

0 commit comments

Comments
 (0)