From 45de8971909f2a201f7a2a5412be1de00cc40f93 Mon Sep 17 00:00:00 2001 From: Ben Hamm Date: Thu, 5 Nov 2026 15:37:17 -0800 Subject: [PATCH 1/2] test(replay): detect AISimulate under the aisim distribution name AISimulate 0.14.0 ships as the `aisim` distribution (the import name is still `aisimulate`), and release/1.7.0 pins `aisim==0.14.0`. The replay integration gate in tests/replay/replay_utils.py only looked up `distribution("aisimulate")`, so with `aisim` installed it raised PackageNotFoundError and skipped: test_replay_planner_scaling.py was skipped at module level and test_replay_smoke.py::test_planner_replay_accepts_multi_shard_dynamo_trace skipped in its body, with no failure to flag the lost coverage. Accept either distribution name, `aisim` first and then `aisimulate`, so the gate works on main (still pinned to `aisimulate==0.13.0.dev...`) and on branches that pin `aisim`. The tests still skip when neither is installed, and the skip reason now names both distributions. Internal tracking: Linear AISIM-2278. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Ben Hamm --- .../python/tests/replay/replay_utils.py | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/bindings/python/tests/replay/replay_utils.py b/lib/bindings/python/tests/replay/replay_utils.py index ce690da35553..052950a073fa 100644 --- a/lib/bindings/python/tests/replay/replay_utils.py +++ b/lib/bindings/python/tests/replay/replay_utils.py @@ -37,14 +37,23 @@ """ +# AISimulate ships as the ``aisim`` distribution from 0.14.0 onward; earlier +# releases used ``aisimulate``. The import name is ``aisimulate`` for both. +_AISIMULATE_DISTRIBUTIONS = ("aisim", "aisimulate") + + def _require_aisimulate_distribution(*, allow_module_level: bool = False) -> None: - try: - distribution("aisimulate") - except PackageNotFoundError: - pytest.skip( - "Dynamo replay integration tests require the optional AISimulate distribution", - allow_module_level=allow_module_level, - ) + for name in _AISIMULATE_DISTRIBUTIONS: + try: + distribution(name) + return + except PackageNotFoundError: + continue + pytest.skip( + "Dynamo replay integration tests require the optional AISimulate " + f"distribution (one of {', '.join(_AISIMULATE_DISTRIBUTIONS)})", + allow_module_level=allow_module_level, + ) def _vllm_args_payload(): From 40f7b8097655b70d944ca23261f847f92888f716 Mon Sep 17 00:00:00 2001 From: Ben Hamm Date: Mon, 9 Nov 2026 10:08:06 -0800 Subject: [PATCH 2/2] test(replay): require the aisimulate import, not just an aisim distribution An unrelated project also publishes under the aisim name. Check that the aisimulate import package exists before running the replay tests, so that package alone skips the tests instead of failing at import. Refs: Linear AISIM-2278 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Ben Hamm --- lib/bindings/python/tests/replay/replay_utils.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/bindings/python/tests/replay/replay_utils.py b/lib/bindings/python/tests/replay/replay_utils.py index 052950a073fa..d34081035866 100644 --- a/lib/bindings/python/tests/replay/replay_utils.py +++ b/lib/bindings/python/tests/replay/replay_utils.py @@ -6,6 +6,7 @@ import subprocess import sys from importlib.metadata import PackageNotFoundError, distribution +from importlib.util import find_spec from pathlib import Path import numpy as np @@ -38,17 +39,24 @@ # AISimulate ships as the ``aisim`` distribution from 0.14.0 onward; earlier -# releases used ``aisimulate``. The import name is ``aisimulate`` for both. +# releases used ``aisimulate``. The import name is ``aisimulate`` for both, and an +# unrelated project also uses the ``aisim`` name, so require the import as well. _AISIMULATE_DISTRIBUTIONS = ("aisim", "aisimulate") -def _require_aisimulate_distribution(*, allow_module_level: bool = False) -> None: +def _aisimulate_installed() -> bool: for name in _AISIMULATE_DISTRIBUTIONS: try: distribution(name) - return except PackageNotFoundError: continue + return find_spec("aisimulate") is not None + return False + + +def _require_aisimulate_distribution(*, allow_module_level: bool = False) -> None: + if _aisimulate_installed(): + return pytest.skip( "Dynamo replay integration tests require the optional AISimulate " f"distribution (one of {', '.join(_AISIMULATE_DISTRIBUTIONS)})",