diff --git a/test/unit/test_assembly.py b/test/unit/test_assembly.py index beeafbc..5067110 100644 --- a/test/unit/test_assembly.py +++ b/test/unit/test_assembly.py @@ -578,6 +578,11 @@ def test_init_assembly_enforcement_mode_forwarded_to_client( mode: str, ) -> None: """All three valid EnforcementMode values land on the GatewayClient.""" + # Force the pure-Python path so `enforce` does not trigger the AAASM-3402 + # native gRPC registration (which would fail-closed without a live gateway). + # This keeps the test focused on enforcement-mode forwarding regardless of + # whether the native `_core` extension is built (AAASM-3435). + monkeypatch.setattr(core_assembly, "_native_core_available", lambda: False) monkeypatch.setattr(core_assembly, "_register_adapters", lambda **kwargs: []) monkeypatch.setattr( core_assembly, diff --git a/test/unit/test_types_audit_event.py b/test/unit/test_types_audit_event.py index 1c9f457..cb0fe64 100644 --- a/test/unit/test_types_audit_event.py +++ b/test/unit/test_types_audit_event.py @@ -11,6 +11,15 @@ import pytest from agent_assembly import AuditEvent, CallStackNode +from agent_assembly.core.runtime_interceptor import _native_core_available + +# The native `_core` extension implements the wire codec; these import-error +# guards only fire in pure-Python mode where it is absent (AAASM-3435). +_NATIVE_CORE_PRESENT = _native_core_available() +_requires_no_native_core = pytest.mark.skipif( + _NATIVE_CORE_PRESENT, + reason="native `_core` is present; the import-error path only exists without it", +) def test_call_stack_node_required_fields() -> None: @@ -98,6 +107,7 @@ def test_top_level_imports_resolve_to_types_module() -> None: assert CallStackNode is TypesCallStackNode +@_requires_no_native_core def test_to_wire_bytes_raises_helpful_import_error_without_native_core() -> None: """In pure-Python mode the native `_core` extension is absent, so the encode path raises ImportError with a maturin/reinstall hint.""" @@ -110,6 +120,7 @@ def test_to_wire_bytes_raises_helpful_import_error_without_native_core() -> None assert "maturin develop" in message +@_requires_no_native_core def test_from_wire_bytes_raises_helpful_import_error_without_native_core() -> None: """The decode path raises the same kind of guidance when `_core` is absent.""" with pytest.raises(ImportError) as exc_info: