1# Copyright 2020 Huawei Technologies Co., Ltd 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================ 15""" 16@File : ut_filter.py 17@Desc : filter for ge or gpu 18""" 19 20import os 21import pytest 22 23 24def is_enable_ge(): 25 val = os.getenv("ENABLE_GE", "False") 26 if val in ('ON', 'on', 'TRUE', 'True', 'true'): 27 return True 28 return False 29 30 31non_graph_engine = pytest.mark.skipif(is_enable_ge(), reason="Not support running on GE environment") 32 33 34def is_enable_gpu(): 35 val = os.getenv("ENABLE_GPU", "False") 36 if val in ('ON', 'on', 'TRUE', 'True', 'true'): 37 return True 38 return False 39 40 41run_on_gpu = pytest.mark.skipif(not is_enable_gpu(), reason="Only support running on GPU environment") 42 43 44def is_enable_onnxruntime(): 45 val = os.getenv("ENABLE_ONNXRUNTIME", "False") 46 if val in ('ON', 'on', 'TRUE', 'True', 'true'): 47 return True 48 return False 49 50 51run_on_onnxruntime = pytest.mark.skipif(not is_enable_onnxruntime(), reason="Only support running on onnxruntime") 52