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

Only launch pytest with coverage in Makefile if env var is set #2072

Merged
merged 1 commit into from
Aug 22, 2023
Merged
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
4 changes: 4 additions & 0 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
run: make install-common-test
- name: Run common precommit test scope
run: make test-common
env:
NNCF_COVERAGE: 1
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v3
with:
Expand All @@ -44,6 +46,8 @@ jobs:
run: make install-onnx-test
- name: Run ONNX precommit test scope
run: make test-onnx
env:
NNCF_COVERAGE: 1
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v3
with:
Expand Down
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
JUNITXML_PATH ?= nncf-tests.xml
COVERAGE ?= --cov=./ --cov-report=xml

ifdef NNCF_COVERAGE
COVERAGE_ARGS ?= --cov=./ --cov-report=xml
else
COVERAGE_ARGS :=
endif

ifdef DATA
DATA_ARG := --data $(DATA)
Expand All @@ -26,7 +31,7 @@ install-onnx-dev: install-onnx-test install-pre-commit install-pylint
pip install -r examples/post_training_quantization/onnx/mobilenet_v2/requirements.txt

test-onnx:
pytest ${COVERAGE} tests/onnx $(DATA_ARG) --junitxml ${JUNITXML_PATH}
pytest ${COVERAGE_ARGS} tests/onnx $(DATA_ARG) --junitxml ${JUNITXML_PATH}

pylint-onnx:
pylint --rcfile .pylintrc \
Expand Down Expand Up @@ -60,8 +65,7 @@ install-openvino-dev: install-openvino-test install-pre-commit install-pylint
pip install -r examples/post_training_quantization/openvino/yolov8_quantize_with_accuracy_control/requirements.txt

test-openvino:
# omitting ${COVERAGE} for internal runs since they seem to introduce a major slowdown
pytest tests/openvino $(DATA_ARG) --junitxml ${JUNITXML_PATH}
pytest ${COVERAGE_ARGS} tests/openvino $(DATA_ARG) --junitxml ${JUNITXML_PATH}

pylint-openvino:
pylint --rcfile .pylintrc \
Expand Down Expand Up @@ -91,8 +95,7 @@ install-tensorflow-dev: install-tensorflow-test install-pre-commit install-pylin
pip install -r examples/post_training_quantization/tensorflow/mobilenet_v2/requirements.txt

test-tensorflow:
# omitting ${COVERAGE} for internal runs since they seem to introduce a major slowdown
pytest tests/common tests/tensorflow \
pytest ${COVERAGE_ARGS} tests/common tests/tensorflow \
--junitxml ${JUNITXML_PATH} \
$(DATA_ARG)

Expand Down Expand Up @@ -121,8 +124,7 @@ install-torch-dev: install-torch-test install-pre-commit install-pylint
pip install -r examples/post_training_quantization/torch/ssd300_vgg16/requirements.txt

test-torch:
# omitting ${COVERAGE} for internal runs since they seem to introduce a major slowdown
pytest tests/common tests/torch --junitxml ${JUNITXML_PATH} $(DATA_ARG)
pytest ${COVERAGE_ARGS} tests/common tests/torch --junitxml ${JUNITXML_PATH} $(DATA_ARG)

COMMON_PYFILES := $(shell python3 tools/collect_pylint_input_files_for_backend.py common)
pylint-torch:
Expand Down Expand Up @@ -160,7 +162,7 @@ pylint-common:
$(COMMON_PYFILES)

test-common:
pytest ${COVERAGE} tests/common $(DATA_ARG) --junitxml ${JUNITXML_PATH}
pytest ${COVERAGE_ARGS} tests/common $(DATA_ARG) --junitxml ${JUNITXML_PATH}

test-examples:
pytest tests/cross_fw/examples -s --junitxml ${JUNITXML_PATH}
Expand Down