Skip to content

Order-dependent perf CLI test misses Transformers warning in full commands partition #1297

Description

@ssss141414

Summary

The Windows commands CI partition deterministically fails at
TestPerfUnifiedPipeline::test_cli_hf_reveals_huggingface_warning_logs_when_verbose
when the test runs in normal file/partition order, while the focused test passes.

This reproduces at exact base 79d7baad10f28cd79e65072f78494e8be758f3df and at candidate
4d1998a6befc385d3aff48ae01ca959273727868. The candidate changes only two OWLv2
recipe JSON files, so the failure is not introduced by that delta.

Environment

  • Windows 11
  • Python 3.11.14
  • pytest 9.0.3
  • transformers 5.14.1
  • isolated checkout and private TEMP/TMP per run
  • inherited PYTHONPATH, pytest, Transformers, HF Hub, progress, WinML provider, and coverage variables cleared before each run

Exact workflow reproduction

uv run pytest tests/unit/commands tests/unit/config tests/unit/build tests/unit/compiler tests/unit/session tests/unit/eval --tb=short --no-cov -m "not e2e and not npu and not gpu"

Result on both exact refs:

tests/unit/commands/test_perf_cli.py::TestPerfUnifiedPipeline::test_cli_hf_reveals_huggingface_warning_logs_when_verbose FAILED [ 25%]
tests\unit\commands\test_perf_cli.py:1149: assert False

The focused target passes in a fresh process:

1 passed in 2.76s

The full tests/unit/commands/test_perf_cli.py file fails at the same assertion.

Minimal ordered reproduction

uv run pytest `
  tests/unit/commands/test_perf_cli.py::TestPerfUnifiedPipeline::test_load_model_does_not_forward_export_policy_details `
  tests/unit/commands/test_perf_cli.py::TestPerfUnifiedPipeline::test_cli_hf_reveals_huggingface_warning_logs_when_verbose `
  --tb=short --no-cov

Result:

test_load_model_does_not_forward_export_policy_details PASSED [ 50%]
test_cli_hf_reveals_huggingface_warning_logs_when_verbose FAILED [100%]
1 failed, 1 passed in 26.81s

Diagnosis

An external pytest diagnostic plugin recorded logging.getLogger("transformers")
without changing the checkout. At session start:

{"effective_level": 30, "handlers": [], "imported": false, "level": 0, "propagate": true}

Immediately after test_load_model_does_not_forward_export_policy_details:

{"effective_level": 30, "handlers": ["StreamHandler"], "imported": true, "level": 30, "propagate": false}

Transformers 5.14.1 _configure_library_root_logger() installs the handler and sets
propagate = false outside CI. WinML's Hugging Face suppression context saves and restores
verbosity, but does not restore the pre-existing logger handler/propagation topology. The later
test emits through logging.getLogger("transformers"); with propagation disabled, pytest's root
caplog handler does not receive the record, so the second assertion fails.

The test or logging utility should isolate/restore the Transformers logger topology, or the
assertion should capture the library logger in a way that is independent of prior import order.

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