"""Packaging smoke test. Guards against ``pyproject.toml`` regressions (see Client.Python-018) that break ``pip wheel`` / ``pip install -e`` while leaving the in-tree ``pytest`` suite green via ``[tool.pytest.ini_options] pythonpath = ["src"]``. The test invokes ``python -m pip wheel . --no-deps`` against the package root and asserts a wheel file is produced. Any future PEP 639 / SPDX violation (or any other ``setuptools.build_meta`` configuration error) will be caught here at test time rather than at first install on a clean machine. """ from __future__ import annotations import pathlib import subprocess import sys _PACKAGE_ROOT = pathlib.Path(__file__).resolve().parent.parent def test_pip_wheel_build_succeeds(tmp_path: pathlib.Path) -> None: """``pip wheel .`` against the package root produces a wheel. This exercises ``setuptools.build_meta`` end-to-end — the same path used by ``pip install -e .`` — and would have caught Client.Python-018 at commit time. """ result = subprocess.run( [ sys.executable, "-m", "pip", "wheel", ".", "--no-deps", "--wheel-dir", str(tmp_path), ], cwd=str(_PACKAGE_ROOT), capture_output=True, text=True, ) assert result.returncode == 0, ( f"pip wheel failed (exit {result.returncode}):\n" f"--- stdout ---\n{result.stdout}\n" f"--- stderr ---\n{result.stderr}" ) wheels = list(tmp_path.glob("mxaccess_gateway_client-*.whl")) assert wheels, ( "expected a mxaccess_gateway_client wheel in " f"{tmp_path}; got {list(tmp_path.iterdir())}" )