Skip to content

Commit c1a9bab

Browse files
committed
RHAIENG-304: tests(pytests): update the pyproject.toml integrity test since we no longer have Pipfiles anymore
1 parent 429d19f commit c1a9bab

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

runtimes/rocm-tensorflow/ubi9-python-3.12/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "rocm-tensorflow-ubi9-python-3.12"
33
version = "0.1.0"
4-
requires-python = ">=3.12, <3.13"
4+
requires-python = "==3.12.*"
55

66
dependencies = [
77
"tf2onnx~=1.16.1",

runtimes/tensorflow/ubi9-python-3.12/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "tensorflow-ubi9-python-3.12"
33
version = "0.1.0"
4-
requires-python = ">=3.12, <3.13"
4+
requires-python = "==3.12.*"
55

66
dependencies = [
77
"tf2onnx~=1.16.1",

tests/test_main.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import tomllib
88
from typing import TYPE_CHECKING
99

10+
import pytest
11+
1012
from tests import PROJECT_ROOT
1113

1214
if TYPE_CHECKING:
@@ -15,18 +17,24 @@
1517
MAKE = shutil.which("gmake") or shutil.which("make")
1618

1719

18-
def test_image_pipfiles(subtests: pytest_subtests.plugin.SubTests):
19-
for file in PROJECT_ROOT.glob("**/Pipfile"):
20-
with subtests.test(msg="checking Pipfile", pipfile=file):
21-
print(file)
20+
def test_image_pyprojects(subtests: pytest_subtests.plugin.SubTests):
21+
for file in PROJECT_ROOT.glob("**/pyproject.toml"):
22+
logging.info(file)
23+
with subtests.test(msg="checking pyproject.toml", pipfile=file):
2224
directory = file.parent # "ubi9-python-3.11"
23-
_ubi, _lang, python = directory.name.split("-")
25+
try:
26+
_ubi, _lang, python = directory.name.split("-")
27+
except ValueError:
28+
pytest.skip(f"skipping {directory.name}/pyproject.toml as it is not an image directory")
2429

2530
with open(file, "rb") as fp:
26-
pipfile = tomllib.load(fp)
27-
assert "requires" in pipfile, "Pipfile is missing a [[requires]] section"
28-
assert pipfile["requires"]["python_version"] == python, (
29-
"Pipfile does not declare the expected Python version"
31+
pyproject = tomllib.load(fp)
32+
assert "project" in pyproject, "pyproject.toml is missing a [project] section"
33+
assert "requires-python" in pyproject["project"], (
34+
"pyproject.toml is missing a [project.requires-python] section"
35+
)
36+
assert pyproject["project"]["requires-python"] == f"=={python}.*", (
37+
"pyproject.toml does not declare the expected Python version"
3038
)
3139

3240

0 commit comments

Comments
 (0)