Testing Python Libraries

Designs and implements pytest test suites for Python libraries with fixtures, parametrization, mocking, Hypothesis property-based testing, and CI configuration. Use when creating tests, improving coverage, setting up testing infrastructure, or implementing property-based testing.

115 stars 18 forksTesting & QA Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add wdm0006/python-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add wdm0006/python-skills --skill testing-python-libraries
Manual install
git clone --depth 1 https://github.com/wdm0006/python-skills.git /tmp/python-skills
mkdir -p ~/.claude/skills
cp -r /tmp/python-skills/skills/python/testing-strategy ~/.claude/skills/testing-python-libraries

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Python Library Testing

## Quick Start

```bash
uv run pytest                       # Run tests
uv run pytest --cov=my_library      # With coverage
uv run pytest -x                    # Stop on first failure
uv run pytest -k "test_encode"      # Run matching tests
```

## Pytest Configuration

```toml
# pyproject.toml
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-ra -q --cov=my_library --cov-fail-under=85"

[tool.coverage.run]
branch = true
source = ["src/my_library"]
```

### Test the installed package, not the source tree

pytest's default `prepend` import mode puts the first directory without an
`__init__.py` on `sys.path` — and with a layout that has a package directory
beside compiled or generated parts (a `python-source` layout for a native
extension, a repo-root package next to `tests/`), `import my_library` then
resolves to the **raw source tree** instead of the installed wheel. The result is
either a spurious `ModuleNotFoundError` (the compiled submodule only exists in the
wheel) or, worse, a green run against code that is not what ships.

Fix it in config so local runs, CI, and a teammate's checkout behave identically,
rather than patching one workflow:

```toml
[tool.pytest.ini_options]
addopts = "-ra -q --import-mode=importlib"
```

`importlib` mode stops pytest from mutating `sys.path`, so imports resolve only
through the environment's installed distribution. Pair it with a non-editable
Read the full skill on GitHub

Details

Skill name
testing-python-libraries
Path
skills/python/testing-strategy/SKILL.md
License
MIT
Repo updated
18 November 2026

FAQ

What does the Testing Python Libraries skill do?

Designs and implements pytest test suites for Python libraries with fixtures, parametrization, mocking, Hypothesis property-based testing, and CI configuration. Use when creating tests, improving coverage, setting up testing infrastructure, or implementing property-based testing.

How do I install the Testing Python Libraries skill?

Claude Code plugin: /plugin marketplace add wdm0006/python-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Testing Python Libraries popular?

It lives in wdm0006/python-skills, which has 115 GitHub stars and 18 forks.

Related skills

Auditing Python Security

115

wdm0006/python-skills

Audits Python libraries for security vulnerabilities using Bandit, pip-audit, Semgrep, and detect-secrets. Identifies SQL injection, command injection, hardcoded credentials, secrets exposed through tracebacks, weak cryptography, and insecure deserialization. Use when reviewing library security, setting up security scanning in CI, or implementing secure coding patterns.

Security18

Building Accessible Interfaces

115

wdm0006/python-skills

Makes web and app UIs usable by keyboard, screen-reader, low-vision and motion-sensitive users — semantic HTML before ARIA, labelled controls, visible focus, WCAG AA contrast measured rather than eyeballed, touch targets, reduced motion, and automated axe checks plus a manual keyboard pass in CI or before every UI PR. Use when building or restyling a screen, adding a form, modal, menu or custom control, choosing colors, or reviewing a UI change.

Frontend & Design18

Building Browser Extensions

115

wdm0006/python-skills

Builds and tests Manifest V3 browser extensions — service-worker message channels that survive teardown, chrome.storage read-modify-write safety, settings validation in the popup, and a Jest chrome mock that can actually fail. Use when writing or reviewing a background service worker, a popup that reads/writes chrome.storage, an extension's Jest suite, or debugging an extension whose UI silently stops responding.

Software Development18

Wp Test Strategy

116

jorgerosal/wordpress-skills

WordPress testing strategy and review guidance. Use when planning or reviewing PHPUnit coverage, integration tests, block tests, e2e tests, Playwright flows, WooCommerce test coverage, fixture design, or when user mentions "test strategy", "WordPress tests", "PHPUnit", "integration tests", "Playwright", "e2e", "test coverage", "testing plan", or "regression tests". Helps decide what to test, how deeply to test, and where to focus coverage in WordPress plugins, themes, blocks, and WooCommerce extensions.

Testing & QA13

Review Gate

80

KerberosClaw/kc_ai_skills

Use to review a dispatch before handoff, requirements and plans before implementation, or code after implementation. Runs a fresh reviewer, then a separate context-aware adjudicator; returns evidence-backed dispositions to the main agent. Does not replace tests, acceptance checks or UI QA, and does not authorize execution or publication.

Testing & QAIn 1 list13

Wp Test Strategy

116

jorgerosal/wordpress-skills

WordPress test strategy guidance for Codex. Use when deciding what to test, how deeply to test it, and which mix of unit, integration, and E2E coverage fits a WordPress change.

Testing & QA13

Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.