Skip to content

Commit 1a6ad3c

Browse files
author
Mike Schneider
committed
refactor get py version
1 parent 9b25f3f commit 1a6ad3c

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tests/conftest.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -221,28 +221,26 @@ def mxnet_eia_latest_py_version():
221221

222222
@pytest.fixture(scope="module", params=["py2", "py3"])
223223
def pytorch_training_py_version(pytorch_training_version, request):
224-
if Version(pytorch_training_version) < Version("1.5.0"):
225-
return request.param
224+
if Version(pytorch_training_version) >= Version("1.13"):
225+
return "py39"
226226
elif Version(pytorch_training_version) >= Version("1.9"):
227-
if Version(pytorch_inference_version) >= Version("1.13.1"):
228-
return "py39"
229-
else:
230-
return "py38"
231-
else:
227+
return "py38"
228+
elif Version(pytorch_training_version) >= Version("1.5"):
232229
return "py3"
230+
else:
231+
return request.param
233232

234233

235234
@pytest.fixture(scope="module", params=["py2", "py3"])
236235
def pytorch_inference_py_version(pytorch_inference_version, request):
237-
if Version(pytorch_inference_version) < Version("1.4.0"):
238-
return request.param
236+
if Version(pytorch_inference_version) >= Version("1.13"):
237+
return "py39"
239238
elif Version(pytorch_inference_version) >= Version("1.9"):
240-
if Version(pytorch_inference_version) >= Version("1.13.1"):
241-
return "py39"
242-
else:
243-
return "py38"
244-
else:
239+
return "py38"
240+
elif Version(pytorch_inference_version) >= Version("1.5"):
245241
return "py3"
242+
else:
243+
return request.param
246244

247245

248246
@pytest.fixture(scope="module")

0 commit comments

Comments
 (0)