diff --git a/.github/workflows/run_tests_suite_coverage.yml b/.github/workflows/run_tests_suite_coverage.yml index 49577de96..b9ae5b6ea 100644 --- a/.github/workflows/run_tests_suite_coverage.yml +++ b/.github/workflows/run_tests_suite_coverage.yml @@ -28,25 +28,30 @@ jobs: - name: Install Python 3 uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' - name: Set up Coverage run: | python -m pip install --upgrade pip - pip install coverage + pip install -r requirements.txt coverage pytest pytest-mock + + - name: Run common tests (unittest) + run: coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest discover tests/common_tests -v + + - name: Run common tests (pytest) + run: coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/common - name: Set up TensorFlow environment run: | python -m venv tf_env source tf_env/bin/activate python -m pip install --upgrade pip - pip install -r requirements.txt - pip install tensorflow==2.13.* coverage pytest + pip install -r requirements.txt tensorflow==2.15.* coverage pytest pytest-mock - name: Run TensorFlow testsuite run: | source tf_env/bin/activate - coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest tests/test_suite.py -v + coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest discover tests/keras_tests -v - name: Run TensorFlow pytest run: | @@ -59,12 +64,12 @@ jobs: source torch_env/bin/activate python -m pip install --upgrade pip pip install -r requirements.txt - pip install torch==2.0.* torchvision onnx onnxruntime onnxruntime-extensions coverage pytest + pip install torch==2.5.* torchvision onnx onnxruntime onnxruntime-extensions coverage pytest pytest-mock - name: Run torch testsuite run: | source torch_env/bin/activate - coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest tests/test_suite.py -v + coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" unittest discover tests/pytorch_tests -v - name: Run torch pytest run: | diff --git a/.github/workflows/tests_common.yml b/.github/workflows/tests_common.yml index 89090d949..563d803d5 100644 --- a/.github/workflows/tests_common.yml +++ b/.github/workflows/tests_common.yml @@ -23,6 +23,13 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -r requirements.txt + pip install pytest pytest-mock + pip check + - name: Run unittests run: python -m unittest discover tests/common_tests -v + + - name: Run pytest + run: pytest tests_pytest/common + diff --git a/tests_pytest/core/__init__.py b/tests_pytest/common/__init__.py similarity index 100% rename from tests_pytest/core/__init__.py rename to tests_pytest/common/__init__.py diff --git a/tests_pytest/core/common/__init__.py b/tests_pytest/common/core/__init__.py similarity index 100% rename from tests_pytest/core/common/__init__.py rename to tests_pytest/common/core/__init__.py diff --git a/tests_pytest/core/common/mixed_precision/__init__.py b/tests_pytest/common/core/common/__init__.py similarity index 100% rename from tests_pytest/core/common/mixed_precision/__init__.py rename to tests_pytest/common/core/common/__init__.py diff --git a/tests_pytest/core/common/mixed_precision/resource_utilization_tools/__init__.py b/tests_pytest/common/core/common/mixed_precision/__init__.py similarity index 100% rename from tests_pytest/core/common/mixed_precision/resource_utilization_tools/__init__.py rename to tests_pytest/common/core/common/mixed_precision/__init__.py diff --git a/tests_pytest/common/core/common/mixed_precision/resource_utilization_tools/__init__.py b/tests_pytest/common/core/common/mixed_precision/resource_utilization_tools/__init__.py new file mode 100644 index 000000000..5397dea24 --- /dev/null +++ b/tests_pytest/common/core/common/mixed_precision/resource_utilization_tools/__init__.py @@ -0,0 +1,14 @@ +# Copyright 2025 Sony Semiconductor Israel, Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== diff --git a/tests_pytest/core/common/mixed_precision/resource_utilization_tools/test_resource_utilization_calculator.py b/tests_pytest/common/core/common/mixed_precision/resource_utilization_tools/test_resource_utilization_calculator.py similarity index 100% rename from tests_pytest/core/common/mixed_precision/resource_utilization_tools/test_resource_utilization_calculator.py rename to tests_pytest/common/core/common/mixed_precision/resource_utilization_tools/test_resource_utilization_calculator.py