Skip to content

Commit

Permalink
Rename pytest directories, move test util to correct directory (#1375)
Browse files Browse the repository at this point in the history
* rename pytest directories and move test util to correct dir
  • Loading branch information
irenaby authored Mar 4, 2025
1 parent aa2a182 commit 51be057
Show file tree
Hide file tree
Showing 46 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_keras_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
- name: Run pytest
run: |
pytest tests_pytest/keras
pytest tests_pytest/keras_tests
2 changes: 1 addition & 1 deletion .github/workflows/run_pytorch_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
python -m unittest discover tests/pytorch_tests -v
- name: Run pytest
run: |
pytest tests_pytest/pytorch
pytest tests_pytest/pytorch_tests
6 changes: 3 additions & 3 deletions .github/workflows/run_tests_suite_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
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
run: coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/common_tests

- name: Set up TensorFlow environment
run: |
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Run TensorFlow tests (pytest)
run: |
source tf_env/bin/activate
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/keras
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/keras_tests
- name: Set up PyTorch environment
run: |
Expand All @@ -74,7 +74,7 @@ jobs:
- name: Run PyTorch tests (pytest)
run: |
source torch_env/bin/activate
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/pytorch
coverage run --parallel-mode -m --omit "*__init__.py" --include "model_compression_toolkit/**/*.py" pytest tests_pytest/pytorch_tests
- name: Combine Multiple Coverage Files
run: coverage combine
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
run: python -m unittest discover tests/common_tests -v

- name: Run pytest
run: pytest tests_pytest/common
run: pytest tests_pytest/common_tests

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
RUTarget
from model_compression_toolkit.core.common.mixed_precision.resource_utilization_tools.resource_utilization_calculator import \
Utilization, ResourceUtilizationCalculator, TargetInclusionCriterion, BitwidthMode
from tests_pytest.common.graph_builder_utils import build_node, full_attr_name, build_qc
from tests_pytest.test_util.graph_builder_utils import build_node, full_attr_name, build_qc


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
# ==============================================================================
import pytest
from unittest.mock import Mock, call
from unittest.mock import Mock
import numpy as np
from numpy.testing import assert_array_equal

Expand All @@ -23,7 +23,7 @@
from model_compression_toolkit.core.common.graph.edge import Edge
from model_compression_toolkit.core.common.hessian import HessianInfoService
from model_compression_toolkit.core.common.model_collector import create_stats_collector_for_node, create_tensor2node, ModelCollector
from tests_pytest.common.graph_builder_utils import build_node, DummyLayer, build_qc
from tests_pytest.test_util.graph_builder_utils import build_node, DummyLayer, build_qc


@pytest.fixture
Expand Down
5 changes: 2 additions & 3 deletions tests_pytest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
from mct_quantizers import QuantizationMethod
from unittest.mock import Mock

from pytest import fixture

from model_compression_toolkit.core import FrameworkInfo, QuantizationConfig
from model_compression_toolkit.core import FrameworkInfo
from model_compression_toolkit.core.common import Graph
from model_compression_toolkit.core.common.framework_implementation import FrameworkImplementation
from model_compression_toolkit.target_platform_capabilities import OpQuantizationConfig, Signedness, \
QuantizationConfigOptions, TargetPlatformCapabilities
QuantizationConfigOptions, QuantizationMethod, TargetPlatformCapabilities


@fixture
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from packaging import version
import tensorflow as tf

from tests_pytest.base_test_classes.base_tpc_attach2fw_test import BaseTpcAttach2FrameworkTest
from tests_pytest.fw_tests_common_base.base_tpc_attach2fw_test import BaseTpcAttach2FrameworkTest

if version.parse(tf.__version__) >= version.parse("2.13"):
from keras.src.layers import Conv2D, Identity
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from model_compression_toolkit.target_platform_capabilities import LayerFilterParams
from model_compression_toolkit.target_platform_capabilities.targetplatform2framework.attach2pytorch import \
AttachTpcToPytorch
from tests_pytest.base_test_classes.base_tpc_attach2fw_test import BaseTpcAttach2FrameworkTest
from tests_pytest.fw_tests_common_base.base_tpc_attach2fw_test import BaseTpcAttach2FrameworkTest


class TestAttachTpc2Pytorch(BaseTpcAttach2FrameworkTest):
Expand Down
14 changes: 14 additions & 0 deletions tests_pytest/test_util/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
# ==============================================================================
File renamed without changes.

0 comments on commit 51be057

Please sign in to comment.