In short.
Python Testing Patterns is a skill for developers using coding assistants to write Python tests, but several examples require additional application code or configuration. Its main guide and two references provide concrete pytest patterns from basic assertions to database tests and CI configuration. Some snippets omit implementations or real cleanup operations; dependency compatibility and execution results are unknown.
Researched and written by an AI model and checked by a second AI model. How it works
Covers the complete selected folder plugins/python-development/skills/python-testing-patterns at commit 9c61ab243def98f72da12abd41cfcf5bcd91af9d: SKILL.md, references/details.md and references/advanced-patterns.md. The repository-root LICENSE is included as a related notice outside that folder. Other repository skills, surrounding plugin implementation, third-party documentation and dependency licences are outside scope. No examples, commands or workflows were executed. Runtime correctness, assistant-host integration, database behavior, coverage results, performance and CI success are UNVERIFIED.
The overview
identity
Python Testing Patterns is the python-testing-patterns skill in wshobson/agents. Its selected folder contains SKILL.md, references/details.md and references/advanced-patterns.md. The main file has a skill name and description followed by instructions and examples for Python testing.
The original source folder is [https://github.com/wshobson/agents/tree/main/plugins/python-development/skills/python-testing-patterns]. The supplied source version is commit 9c61ab243def98f72da12abd41cfcf5bcd91af9d. Compatibility with a particular coding assistant or skill loader is not established.
assessment
This is useful guidance for a developer who wants concrete patterns to adapt while building a Python test suite. The basic reference connects example application code with assertions, reusable setup, multiple input cases, simulated HTTP responses and expected exceptions.
Treat its broader examples as templates requiring engineering judgment. The files do not establish a complete application test suite, reproducible dependency environment or successful CI run. Runtime correctness and project compatibility are UNVERIFIED.
users
Beginners can use the calculator tests and Arrange, Act, Assert explanation to understand how inputs, actions and expected results fit together. Fixtures are introduced as reusable setup and cleanup, while parameterization demonstrates running the same test against several inputs.
Experienced Python developers may find the examples for retry behavior, dependency mocking, environment overrides, asynchronous operations, SQLAlchemy sessions and coverage configuration more relevant. Teams seeking automatic installation into a specific assistant or a complete project template would need additional documentation.
capabilities
The supplied examples cover basic assertions, exception checks, fixture scopes, parameterized tests, HTTP mocking, retry side effects, frozen time, test markers and coverage reports. They also illustrate descriptive test names, focused behaviors and failure cases.
The advanced reference adds async functions and concurrent coroutines, temporary files, shared conftest.py fixtures, Hypothesis-generated inputs and SQLAlchemy tests using in-memory SQLite. It includes pytest.ini and pyproject.toml configuration examples plus a GitHub Actions workflow. These are documented patterns; successful operation is not established.
Using it
requirements
Running the basic test examples requires Python and pytest. Individual patterns introduce additional dependencies: requests for the HTTP client example, freezegun for controlling time, Hypothesis for generated test inputs, SQLAlchemy for database examples and pytest-cov for coverage commands.
The async examples use pytest.mark.asyncio and an async fixture, but no corresponding plugin installation, dependency version or async-mode setting is supplied. The CI workflow assumes the target project supports editable installation with dev extras. No complete dependency specification or lockfile appears in the selected folder.
mechanism
The skill supplies written instructions and code examples for an assistant or developer to interpret. SKILL.md introduces the testing concepts and points to the two reference files for detailed patterns.
The examples use pytest to discover test functions and evaluate assertions. Fixtures provide setup and cleanup around tests; parameterization repeats a test with different inputs; mocks replace external calls with controlled responses or errors. Hypothesis examples express properties that should hold across generated inputs.
setup
Keep SKILL.md together with references/details.md and references/advanced-patterns.md so the relative reference links remain usable. The supplied files do not describe installation into a particular assistant host.
For manual use, the quick start places a small function and two tests in test_example.py and gives the command pytest test_example.py. Coverage examples add pytest-cov and commands such as pytest --cov=myapp --cov-report=term-missing tests/. Replace myapp with the actual package and install the dependencies needed by the chosen examples.
example
The retry example gives a mock client's request method two ConnectionError responses followed by a successful result. Its assertions expect the service to return that result after three calls. Companion examples describe stopping after the retry limit and avoiding retries for a ValueError.
This illustrates how to check failure handling without contacting a real service. However, ServiceWithRetry is referenced without an implementation, so the example requires application code before it can be executed. No passing result is supplied.
Assessment & evidence
limitations
Several snippets reference application components without defining them, including ServiceWithRetry, create_token, Token and user-service objects. Some fragments also depend on imports or surrounding code that must be added.
The advanced reset_database fixture prints messages but performs no database-clearing operation. The db_backend fixture supplies backend names and checks their membership in a list; it does not demonstrate connections to SQLite, PostgreSQL and MySQL.
Some example assertions leave gaps. The default database-URL test checks only that a value is truthy. The sorting properties check length, set equality and order without checking duplicate counts, so they do not fully establish preservation of every occurrence.
Async fixture compatibility and the CI workflow are unverified. The guide names functional and performance testing, but the supplied files provide no complete application journey, performance measurements or execution results.
reasoning
The examples show why reusable setup and controlled dependencies can make tests easier to understand. Fixture scope determines how widely setup is shared, while mock responses let a test target specific success and failure paths. Assertions about mocked calls do not establish that the real external integration works.
The guidance favors independent tests, focused behaviors, failure cases and meaningful coverage. Its example 80% coverage threshold is a configurable rule, not evidence of correctness. Adapting the patterns requires assertions tied to the application's intended behavior.
alternatives
Developers can also read and adapt the standalone pytest and unittest.mock examples manually. The files contain enough example code to explain these patterns without relying on a particular assistant host.
Hypothesis and freezegun appear as specialist complements for generated inputs and controlled clocks. The supplied evidence contains no comparison with another instruction skill or testing framework, so relative quality, performance and ease of integration are unknown.
evidence
The main skill file is available at its fixed source version: [https://raw.githubusercontent.com/wshobson/agents/9c61ab243def98f72da12abd41cfcf5bcd91af9d/plugins/python-development/skills/python-testing-patterns/SKILL.md]. It establishes the skill's identity, intended uses, basic guidance and reference links.
The fundamental examples are in [https://raw.githubusercontent.com/wshobson/agents/9c61ab243def98f72da12abd41cfcf5bcd91af9d/plugins/python-development/skills/python-testing-patterns/references/details.md]. Advanced examples and configuration are in [https://raw.githubusercontent.com/wshobson/agents/9c61ab243def98f72da12abd41cfcf5bcd91af9d/plugins/python-development/skills/python-testing-patterns/references/advanced-patterns.md].
The related repository licence notice is [https://raw.githubusercontent.com/wshobson/agents/9c61ab243def98f72da12abd41cfcf5bcd91af9d/LICENSE]. These files establish documented content and permissions. No execution results establish passing tests, coverage levels, timing or CI success.
Access & freshness
costs
The supplied files do not state a purchase price, subscription fee, assistant usage charge or total running cost. Those costs are unknown.
The MIT notice grants permission to use and redistribute the material, but it does not establish the cost of a coding assistant, CI runner, database environment or external service used with the examples. No usage measurements or cost estimates are supplied.
rights
The captured repository LICENSE is the MIT License, with copyright attributed to Seth Hobson in 2024. It permits use, copying, modification, publication, distribution, sublicensing and sale.
Copies or substantial portions must retain the copyright and permission notice. The licence provides the material without warranty and disclaims liability. Licences for imported third-party dependencies are not established by these files.
freshness
The supplied snapshot was captured on 17 November 2026 at 14:47:24.353 UTC and identifies source commit 9c61ab243def98f72da12abd41cfcf5bcd91af9d. Later changes to the main branch are unknown.
The CI example lists Python 3.9, 3.10, 3.11 and 3.12 and uses versioned GitHub Action references. These are sample configuration values, not verified support claims. Current dependency compatibility and successful operation across that matrix are unknown.
actions
Start with one pattern that matches an existing application behavior. Replace example package names and application placeholders, install the dependencies that pattern needs, and write assertions for both expected results and relevant failures.
Before adopting the advanced templates, implement actual database cleanup, confirm async plugin and fixture configuration, and adapt CI installation to the project. Inspect coverage exclusions and strengthen assertions where necessary. Execute the adapted tests in the intended environment before relying on their results.
