Restore parsed TOML assertions in Python artifact test

This commit is contained in:
Shaqayeq
2026-03-24 14:01:07 -07:00
parent a961d299e0
commit 5a7db9e60b
2 changed files with 20 additions and 8 deletions
+6 -1
View File
@@ -30,7 +30,12 @@ Repository = "https://github.com/openai/codex"
Issues = "https://github.com/openai/codex/issues"
[project.optional-dependencies]
dev = ["pytest>=8.0", "datamodel-code-generator==0.31.2", "ruff>=0.11"]
dev = [
"pytest>=8.0",
"datamodel-code-generator==0.31.2",
"ruff>=0.11",
"tomli>=2.0; python_version < '3.11'",
]
[tool.hatch.build]
exclude = [
@@ -10,6 +10,11 @@ from pathlib import Path
import pytest
try:
import tomllib
except ModuleNotFoundError: # pragma: no cover - Python 3.10 fallback.
import tomli as tomllib
ROOT = Path(__file__).resolve().parents[1]
@@ -223,7 +228,7 @@ def test_release_metadata_retries_without_invalid_auth(monkeypatch: pytest.Monke
def test_runtime_package_is_wheel_only_and_builds_platform_specific_wheels() -> None:
pyproject_text = (ROOT.parent / "python-runtime" / "pyproject.toml").read_text()
pyproject = tomllib.loads((ROOT.parent / "python-runtime" / "pyproject.toml").read_text())
hook_source = (ROOT.parent / "python-runtime" / "hatch_build.py").read_text()
hook_tree = ast.parse(hook_source)
initialize_fn = next(
@@ -263,12 +268,14 @@ def test_runtime_package_is_wheel_only_and_builds_platform_specific_wheels() ->
and isinstance(node.value, ast.Constant)
}
assert "[tool.hatch.build.targets.wheel]" in pyproject_text
assert 'packages = ["src/codex_cli_bin"]' in pyproject_text
assert 'include = ["src/codex_cli_bin/bin/**"]' in pyproject_text
assert "[tool.hatch.build.targets.wheel.hooks.custom]" in pyproject_text
assert "[tool.hatch.build.targets.sdist]" in pyproject_text
assert "[tool.hatch.build.targets.sdist.hooks.custom]" in pyproject_text
assert pyproject["tool"]["hatch"]["build"]["targets"]["wheel"] == {
"packages": ["src/codex_cli_bin"],
"include": ["src/codex_cli_bin/bin/**"],
"hooks": {"custom": {}},
}
assert pyproject["tool"]["hatch"]["build"]["targets"]["sdist"] == {
"hooks": {"custom": {}},
}
assert sdist_guard is not None
assert build_data_assignments == {"pure_python": False, "infer_tag": True}