diff --git a/setup.cfg b/setup.cfg index da38d8823f..bacf0caf0e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,6 @@ line_length = 79 multi_line_output = 0 known_standard_library = pkg_resources,setuptools known_first_party = mmedit -known_third_party =PIL,cv2,lmdb,mmcv,numpy,onnx,onnxruntime,pymatting,pytest,scipy,titlecase,torch,torchvision +known_third_party =PIL,cv2,lmdb,mmcv,numpy,onnx,onnxruntime,packaging,pymatting,pytest,scipy,titlecase,torch,torchvision no_lines_before = STDLIB,LOCALFOLDER default_section = THIRDPARTY diff --git a/tests/test_onnx_wraper.py b/tests/test_onnx_wraper.py index 61d4828a90..29bce6cb0f 100644 --- a/tests/test_onnx_wraper.py +++ b/tests/test_onnx_wraper.py @@ -4,10 +4,15 @@ import numpy as np import pytest import torch +from packaging import version from mmedit.models import build_model +@pytest.mark.skipif(torch.__version__ == 'parrots', reason='skip parrots.') +@pytest.mark.skipif( + version.parse(torch.__version__) < version.parse('1.4.0'), + reason='skip if torch=1.3.x') def test_restorer_wraper(): try: import onnxruntime as ort @@ -55,7 +60,7 @@ def test_restorer_wraper(): opset_version=11) wrap_model = ONNXRuntimeEditing(onnx_path, cfg, 0) - os.remove(onnx_path) + # os.remove(onnx_path) assert isinstance(wrap_model.wraper, ONNXRuntimeRestorer) if ort.get_device() == 'GPU': @@ -71,6 +76,10 @@ def test_restorer_wraper(): assert output.shape == targets.shape +@pytest.mark.skipif(torch.__version__ == 'parrots', reason='skip parrots.') +@pytest.mark.skipif( + version.parse(torch.__version__) < version.parse('1.4.0'), + reason='skip if torch=1.3.x') def test_mattor_wraper(): try: import onnxruntime as ort