ce-fallback-test

Verify fallback visibility with pytest.warns and caplog in pytest tests.

78|15|Updated May 1, 2023
One-click install
npx skills add https://github.com/Moffran/calibrated_explanations --skill ce-fallback-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ce-fallback-test
Source: https://github.com/Moffran/calibrated_explanations/tree/main/.claude/skills/ce-fallback-test
Command: npx skills add https://github.com/Moffran/calibrated_explanations --skill ce-fallback-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Author tests that verify fallback visibility through opt-in fixtures, warning assertions, and INFO log side effects.

Core Features & Use Cases

  • Verifies that enabling fallbacks emits a UserWarning and logs observability signals
  • Enforces correct output remains valid when fallbacks are triggered
  • Documents the expected workflow for pytest-based tests using the provided fixtures

Quick Start

Run a test that enables a fallback path and asserts a UserWarning is emitted while the result remains correct.

Frequently Asked Questions about ce-fallback-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test fallback visibility in pytest when using opt-in fixtures?

Test fallback visibility in pytest by applying the enable_fallbacks fixture, then asserting UserWarning emissions with pytest.warns and verifying INFO log side effects using caplog checks. This ensures fallback behavior remains observable and correct.

How does pytest caplog check INFO log side effects during fallback testing?

pytest caplog captures INFO log side effects during fallback testing by intercepting log records emitted when opt-in fixtures trigger fallback paths. You assert captured records to verify observability signals are correctly logged alongside valid test outputs.

What is the best way to assert UserWarning emissions for opt-in fallback paths?

The best way to assert UserWarning emissions for opt-in fallback paths is using pytest.warns context managers. This verifies that enabling fallbacks explicitly emits the expected warnings while the test confirms output remains valid.

Does this fallback testing workflow apply to calibrated_explanations test suites?

Yes, this fallback testing workflow applies specifically to pytest-based test suites for calibrated_explanations. It enforces using the enable_fallbacks fixture, pytest.warns assertions, and caplog checks to verify robust fallback visibility behavior.

Why are my pytest fallback tests failing when opt-in fixtures are enabled?

pytest fallback tests fail when opt-in fixtures are enabled if warning assertions or caplog checks do not match the emitted UserWarning and INFO log side effects. Ensure the enable_fallbacks fixture is used and outputs remain valid.