Skip to content

api_simulator Tests Missing importorskip Guards — macOS CI Failures #2255

Closed

Description

@Trecek

Problem

8 tests fail on macOS-15 CI with ModuleNotFoundError: No module named 'api_simulator'. The api-simulator package is a Rust/PyO3 extension gated to Linux-only via PEP 508 marker in pyproject.toml:59:

"api-simulator; sys_platform == 'linux'",

When uv sync --locked --extra dev runs on macOS (sys_platform == 'darwin'), the package is never installed. Tests that import it without guards crash instead of being gracefully skipped.

Affected Tests

7 tests with bare import api_simulator.claude or import api_simulator.mcp inside test function bodies:

File Line(s) Import
tests/server/test_factory_recording.py 89, 138, 172, 218 api_simulator.claude
tests/server/test_state.py 132, 211 api_simulator.mcp
tests/execution/test_recording.py 445 api_simulator.claude

1 downstream failure — tests/execution/test_recording_sigterm.py:78 (test_sigterm_writes_scenario_json):

  • Spawns autoskillit serve with RECORD_SCENARIO=1
  • Server catches ImportError gracefully at src/autoskillit/server/_factory.py:241-248 and logs: "RECORD_SCENARIO is set but 'api_simulator' is not installed — skipping recording"
  • scenario.json is never written, assertion fails

Established Pattern

Other tests are properly guarded — follow the same approach:

# tests/execution/test_quota_http.py:17,25
_api_sim_http = pytest.importorskip("api_simulator.http")
pytestmark = [
    pytest.mark.skipif(sys.platform != "linux", reason="api-simulator is Linux-only"),
]

Required Fix

Add pytest.importorskip() at the top of each unguarded test function:

  • For test_factory_recording.py tests: pytest.importorskip("api_simulator.claude")
  • For test_state.py tests: pytest.importorskip("api_simulator.mcp")
  • For test_recording.py test: pytest.importorskip("api_simulator.claude")
  • For test_recording_sigterm.py test: pytest.importorskip("api_simulator") (entire package needed for recording premise)

Context

  • Discovered via PR test #945 macOS-15 CI failure
  • Investigation report: .autoskillit/temp/investigate/investigation_macos_ci_failures_pr945_2026-05-08_160000.md
  • The api-simulator package will NOT be cross-compiled for macOS — the platform marker stays as-is

Activity

  1. added
    in-progressIssue is being actively worked on
    stagedImplementation staged and waiting for promotion to main
    and removed
    in-progressIssue is being actively worked on
    on May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    recipe:implementationRoute through implementation recipestagedImplementation staged and waiting for promotion to main

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions