Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/unit/test_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions test/unit/test_types_audit_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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."""
Expand All @@ -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:
Expand Down