Skip to content

Commit ffef02f

Browse files
committed
Correct TF py version fixtures
1 parent 970eb4e commit ffef02f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/conftest.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,17 +289,23 @@ def tensorflow_inference_py_version(tensorflow_inference_version, request):
289289

290290
def _tf_py_version(tf_version, request):
291291
version = Version(tf_version)
292-
if version == Version("1.15") or Version("1.15.4") <= version < Version("1.16"):
293-
return "py3"
294292
if version < Version("1.11"):
295293
return "py2"
294+
# Some versions of TF 1.15.x, TF 2.0.x, TF 2.1.x do not support py2, while others do.
295+
if version == Version("1.15") or Version("1.15.4") <= version < Version("1.16"):
296+
return "py3"
296297
if version == Version("2.0") or Version("2.0.3") <= version < Version("2.1"):
297298
return "py3"
298299
if version == Version("2.1") or Version("2.1.2") <= version < Version("2.2"):
299300
return "py3"
301+
# Test both py2 and py3 for TF 2.1 and below
300302
if version < Version("2.2"):
301303
return request.param
302-
return "py37"
304+
# Test py37 for TF 2.2 to TF 2.5
305+
if Version("2.2") <= version < Version("2.6"):
306+
return "py37"
307+
# Test py38 for TF 2.6 and above
308+
return "py38"
303309

304310

305311
@pytest.fixture(scope="module")
@@ -329,7 +335,9 @@ def tf_full_py_version(tf_full_version):
329335
return "py2"
330336
if version < Version("2.2"):
331337
return "py3"
332-
return "py37"
338+
if version < Version("2.6"):
339+
return "py37"
340+
return "py38"
333341

334342

335343
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)