Skip to content

test(cli): deflake order-dependent bold accent assertion in test_cli_theme #339

Description

@0xKT

Problem

tests/test_cli_theme.py::test_bold_accent_renders_styled_not_bare (tests/test_cli_theme.py:276) is order-dependent: it passes when run alone and fails when the whole file (or the full suite) runs. It shows up intermittently as the lone unexplained failure in otherwise green full-suite runs, which weakens the whole-suite signal.

Evidence

  • Run alone: passes. Run the whole file: fails. The failure mode is a style degradation: the accent renders as 16-color bright_yellow (SGR 1;93) instead of the truecolor accent #fbe23f, so the assertion that the output is styled-not-bare sees the degraded form.
  • Reproduced byte-identically in two pristine checkouts of recent main-history commits containing no local changes, so it is in-file state pollution (or environment-sensitive terminal capability detection), not a regression from any one change.
  • The degradation direction (truecolor down to 16-color) points at cached console/terminal capability state: some earlier test in the file plausibly constructs a Console (or mutates COLORTERM/TERM/FORCE_COLOR detection) whose downgraded color system leaks into this test.
  • Several independent full-suite runs on the same machine reproduced it while others did not, consistent with ordering/parallelism sensitivity rather than a deterministic bug.

Suggested direction

Find the in-file pollution: run progressively larger prefixes of tests/test_cli_theme.py to identify the first test whose presence flips the result, then audit it for module-level or cached Console/theme state and env mutations that survive the test. Isolate with a fixture that resets the cached theme/console and pins a truecolor-capable fake terminal for this assertion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions