Skip to content

Stabilize missing-method instrumentation test across runtimes - #2734

Closed
xrmx with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-windows-python-3-9-ci-failure
Closed

xrmx with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-windows-python-3-9-ci-failure

Conversation

Copilot AI commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

The Windows Python 3.9 failure came from a brittle test assertion in tests/instrumentation/base_tests.py: it expected runtime-generated AttributeError text that varies across Python/wrapt/platform combinations. This change updates the test to assert the stable agent-generated log message for skipped instrumentation instead.

  • Problem

    • test_instrument_nonexisting_method asserted on "has no attribute", which is not a stable contract of the agent and differs on Windows/Python 3.9.
  • Change

    • Update the assertion to match the stable log prefix emitted by AbstractInstrumentedModule.instrument() when a target method cannot be resolved.
    • Preserve the logger check against elasticapm.instrument.
  • Effect

    • The test now verifies the intended behavior — skipped instrumentation of logging.Logger.non_existing_method — without depending on platform-specific exception wording.
    • No production error handling or workflow behavior is changed.
assert_any_record_contains(
    caplog.records,
    "Skipping instrumentation of logging.Logger.non_existing_method:",
    "elasticapm.instrument",
)

Fixes #2733

Co-authored-by: xrmx <12932+xrmx@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI failure in test_instrument_nonexisting_method on Windows Stabilize missing-method instrumentation test across runtimes Sep 11, 2026
Copilot AI requested a review from xrmx September 11, 2026 07:21
@xrmx
xrmx marked this pull request as ready for review September 11, 2026 07:31
@xrmx
xrmx requested a review from a team as a code owner September 11, 2026 07:31
@xrmx xrmx closed this Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky instrument tests

2 participants