test_register_hooks_binds_pending_and_keeps_trampoline_alive

Tests › tests/unit/test_pythonic_facade.py

absent Not in the packaged run: no test report names it.

What this test is for

Why it exists

The test says nothing about why.

Given

  1. —
→

When

  1. hooks._clear_pending()
  2. fake_handle = ctypes.c_void_p(0xCAFE)
  3. def my_hook(ctx: dict) -> None: return None
4 more
  1. bound = hooks.register_hooks(fake_handle)
  2. handle_key = ctypes.cast(fake_handle, ctypes.c_void_p).value or 0
  3. _bindings.entropic_register_hook.assert_called_once()
  4. call_args = _bindings.entropic_register_hook.call_args
→

Then

  1. · bound equals 1
  2. · hooks._bound contains handle_key
  3. · len(hooks._bound[handle_key]) equals 1
  4. · hooks._bound[handle_key][0].trampoline is not None
  5. · call_args.args[0] is fake_handle
  6. · call_args.args[1] equals int(_bindings.EntropicHookPoint.PRE_TOOL_CALL)

tests/unit/test_pythonic_facade.py:113 · its file's page

What it checks (7)

  1. assert bound == 1 observes register_hooks via bound
  2. assert handle_key in hooks._bound not attributed
  3. assert len(hooks._bound[handle_key]) == 1 not attributed
  4. assert hooks._bound[handle_key][0].trampoline is not None not attributed
  5. _bindings.entropic_register_hook.assert_called_once() not attributed
  6. assert call_args.args[0] is fake_handle not attributed
  7. assert call_args.args[1] == int(_bindings.EntropicHookPoint.PRE_TOOL_CALL) not attributed

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_register_hooks_binds_pending_and_keeps_trampoline_alive→_clear_pending→hook→register_hooks

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

test_register_hooks_binds_pending_and_keeps_trampoline_alive · 7 checksregister_hooks_build_trampolineentropic_allocREQ-ABI-001 · inferredregister_hooksentropic_register_hookREQ-API-005 · inferredregister_hooks_build_trampolineentropic_allocREQ-API-008 · inferredregister_hooksentropic_register_hookREQ-HOOK-001 · inferred
Also reaches 4 requirements

Its run touches their code; that is reach, not proof.