"vscode:/vscode.git/clone" did not exist on "bc2fef9c320601194b23da889fcfcbb7ce9701a9"
Unverified Commit d62c1df3 authored by Gary Miguel's avatar Gary Miguel Committed by GitHub
Browse files

Use pytest.importorskip for onnx tests instead of custom logic (#4185)

parent 75970b61
# onnxruntime requires python 3.5 or above
try:
# This import should be before that of torch
# see https://github.com/onnx/onnx/issues/2394#issuecomment-581638840
import onnxruntime
except ImportError:
onnxruntime = None
from common_utils import set_rng_seed, assert_equal from common_utils import set_rng_seed, assert_equal
import io import io
import pytest
import torch import torch
from torchvision import ops from torchvision import ops
from torchvision import models from torchvision import models
...@@ -20,11 +13,13 @@ from torchvision.models.detection.faster_rcnn import FastRCNNPredictor, TwoMLPHe ...@@ -20,11 +13,13 @@ from torchvision.models.detection.faster_rcnn import FastRCNNPredictor, TwoMLPHe
from collections import OrderedDict from collections import OrderedDict
from typing import List, Tuple from typing import List, Tuple
import pytest
from torchvision.ops._register_onnx_ops import _onnx_opset_version from torchvision.ops._register_onnx_ops import _onnx_opset_version
# In environments without onnxruntime we prefer to
# invoke all tests in the repo and have this one skipped rather than fail.
onnxruntime = pytest.importorskip("onnxruntime")
@pytest.mark.skipif(onnxruntime is None, reason='ONNX Runtime unavailable')
class TestONNXExporter: class TestONNXExporter:
@classmethod @classmethod
def setup_class(cls): def setup_class(cls):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment