From 1f039db91e9bd6fc83b0718731750bb8717b1783 Mon Sep 17 00:00:00 2001 From: David Yastremsky Date: Thu, 9 May 2024 11:56:09 -0700 Subject: [PATCH] Skip tests that require a GPU to pass --- .github/workflows/python-package.yaml | 4 +++- tests/test_model_config.py | 4 ++++ tests/test_result_table_manager.py | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yaml b/.github/workflows/python-package.yaml index c2d3cc287..a89a883c0 100644 --- a/.github/workflows/python-package.yaml +++ b/.github/workflows/python-package.yaml @@ -39,7 +39,9 @@ jobs: fail-fast: false matrix: os: ["ubuntu-22.04"] - python-version: ["3.8", "3.10"] + python-version: ["3.8", "3.11"] + env: + SKIP_GPU_TESTS: 1 # Set this variable to skip GPU tests steps: - uses: actions/checkout@v3 diff --git a/tests/test_model_config.py b/tests/test_model_config.py index 5371107dc..19e30a559 100755 --- a/tests/test_model_config.py +++ b/tests/test_model_config.py @@ -262,6 +262,8 @@ def test_write_config_to_file_with_relative_path(self, mock_os_symlink, *args): def test_instance_group_string(self): """Test out all corner cases of instance_group_string()""" + if os.getenv("SKIP_GPU_TESTS"): + self.skipTest("Skipping this test as it requires GPU") def _test_helper(config_dict, expected_result, gpu_count=None): model_config = ModelConfig.create_from_dictionary(config_dict) @@ -318,6 +320,8 @@ def _test_helper(config_dict, expected_result, gpu_count=None): def test_instance_group_count(self): """Test out all corner cases of instance_group_count()""" + if os.getenv("SKIP_GPU_TESTS"): + self.skipTest("Skipping this test as it requires GPU") def _test_helper(config_dict, expected_result, gpu_count=None): model_config = ModelConfig.create_from_dictionary(config_dict) diff --git a/tests/test_result_table_manager.py b/tests/test_result_table_manager.py index 278ceb5ea..dd7284036 100755 --- a/tests/test_result_table_manager.py +++ b/tests/test_result_table_manager.py @@ -14,6 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import unittest from filecmp import cmp from shutil import rmtree @@ -79,6 +80,8 @@ def test_multi_model_csv_against_golden(self): Match the csvs against the golden versions in tests/common/multi-model-ckpt """ + if os.getenv("SKIP_GPU_TESTS"): + self.skipTest("Skipping this test as it requires GPU") table_manager = self._create_multi_model_result_table_manager() table_manager.create_tables()