Skip to content

Fix imperative pytest.xfail() to use decorator with strict=True #56

@andrewyager

Description

@andrewyager

Bug Report

Description

In src/assets/tests/functional/test_system_admin.py line 9228, an imperative pytest.xfail() call is used instead of the @pytest.mark.xfail(strict=True, ...) decorator.

The imperative form does not support strict=True, which means if the gap is closed (the test would pass), it silently continues reporting as xfail rather than failing as XPASS. This defeats the spec-gap audit cycle described in CLAUDE.md.

Current code

if "anthropic" not in content:
    pytest.xfail(
        "GAP: AI privacy disclosure not rendered "
        "in template (US-SA-143, S2.14.6-03)"
    )

Expected

Use the decorator form with strict=True so that XPASS is detected:

@pytest.mark.xfail(strict=True, reason="GAP: AI privacy disclosure not rendered in template (US-SA-143, S2.14.6-03)")

Note: the imperative form is used here because the xfail is conditional (only triggers when "anthropic" not in content). A refactor may be needed to make the condition work with the decorator — e.g. using pytest.mark.xfail with a condition parameter, or restructuring the test.

Spec Consideration

This is a testing infrastructure fix to comply with the existing CLAUDE.md functional test rules. No spec changes required.

Found during code review of PR #55.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions