Write pytests that test real public interfaces with actual components, no mocking, and precise assertions. MIRA-specific patterns. Use when creating or reviewing tests.
Detected risks:
The 'Real Pytest - No Mocks, Real Tests' skill provides a rigorous approach to writing tests that focus on real public interfaces with actual components, without relying on mocks. It challenges the common practice of testing implementations directly, instead emphasizing the importance of contract-based testing. This approach ensures that tests validate the intended behavior of a module, ensuring that it meets its guarantees, handles expected failures, and operates within defined boundaries. By focusing on actual interactions and failure modes, this skill helps uncover hidden design flaws and improves the overall robustness of the codebase.
Start by analyzing the public interface of the module without looking at the implementation. Document the module's contract, including its purpose, guarantees, expected success scenarios, failure conditions, and dependencies. Then, design tests based on this contract, covering positive, negative, boundary, security, and performance cases.
No, this skill strictly avoids the use of mocks. The tests should interact with actual components to ensure they are testing real functionality, not simulated behavior.
The contract-extractor agent helps verify your expectations about the module's contract by reading the code and reporting contract facts, without exposing implementation details. This step ensures that the module's implementation aligns with your initial contract analysis.
Yes, this approach is applicable to any module where you need to write tests based on public interfaces. However, the module should have a clearly defined public interface for effective contract analysis.
The tests must be able to run in a functioning environment with all dependencies correctly set up. Skipped tests are not allowed, so either the environment needs to be fixed, or the code must be updated to ensure tests can pass.
Quick Setup:
.claude/skills/Repository
taylorsatula/mira-OSS