pytest

pytest is a skill for Claude Code, Codex from jukanntenn/glm-plan-usage. It costs 20 tokens per session (404 once invoked), scanned A, original, MIT.

A guide for writing and organizing Python tests with pytest, a tool that checks whether code behaves as expected. It covers reusable test setup, testing many inputs, and extending pytest with plugins.

In plain words
What is it for?
Use it to arrange tests in a tests/ folder, create fixtures for setup and cleanup, test multiple input cases, check expected errors, and configure pytest plugins or markers.
Why use it?
It gives tests a consistent structure and makes failures easier to understand, while reducing repeated setup code.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to arrange tests in a tests/ folder, create fixtures for setup and cleanup, test multiple input cases, check expected errors, and configure pytest plugins or markers.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jukanntenn/glm-plan-usage/pytest
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add jukanntenn/glm-plan-usage --skill pytest
Clone the repo
git clone --depth 1 https://github.com/jukanntenn/glm-plan-usage

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pytest

README.md
[![agentmods](https://agentmods.dev/badge/skills/jukanntenn/glm-plan-usage/pytest/github.svg)](https://agentmods.dev/skills/jukanntenn/glm-plan-usage/pytest)
Your own site
<a href="https://agentmods.dev/skills/jukanntenn/glm-plan-usage/pytest"><img src="https://agentmods.dev/badge/skills/jukanntenn/glm-plan-usage/pytest/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pytest

Your own site · 80×15
<a href="https://agentmods.dev/skills/jukanntenn/glm-plan-usage/pytest"><img src="https://agentmods.dev/badge/skills/jukanntenn/glm-plan-usage/pytest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 404 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.00404
Opus 5.5 $0.00008 $0.00162
Sonnet 5.5 $0.00004 $0.00081
Haiku 4.5 $0.00002 $0.00040

Measured 2mo ago against content hash badfc1272ceb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

pytest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.trae/skills/pytest/SKILL.md · 49 lines

What it actually says

Skill: pytest

Best practices for writing and organizing tests with pytest including fixtures, parametrize, and plugins.

When to Use

Apply this skill when writing and organizing tests with pytest — fixtures, parametrize, markers, plugins, and test structure.

Test Organization

  • Place tests in a tests/ directory mirroring the source structure.
  • Name test files test_<module>.py and test functions test_<behavior>().
  • Group related tests in classes only when they share fixtures/setup.

Fixtures

  • Define fixtures at the narrowest scope needed (function > class > module > session).
  • Use conftest.py for shared fixtures; put it at the appropriate directory level.
  • Prefer factory fixtures over complex fixture inheritance.
  • Use yield fixtures for setup/teardown; prefer tmp_path over tempfile.

Parametrize

  • Use @pytest.mark.parametrize for data-driven tests with multiple inputs.
  • Give test IDs (ids=...) for readable test output.
  • Combine parametrize with fixtures for cross-product testing.

Assertions

  • Use plain assert statements — pytest rewrites them for clear failure messages.
  • Use pytest.raises(ExceptionType, match=...) for exception testing.
  • Use pytest.approx() for floating-point comparisons.

Plugins

  • Common plugins: pytest-cov, pytest-mock, pytest-asyncio, pytest-xdist, pytest-timeout.
  • Use pytest-mock's mocker fixture over raw unittest.mock.patch.

Pitfalls

  • Don't use session-scoped fixtures for mutable state.
  • Don't assert on implementation details — test observable behavior.
  • Avoid test interdependence; each test should be runnable in isolation.
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 49 lines · 20 tokens per session scan A badfc1272ceb

Subscribe to this mod's changes

pytest is a skill published in the GitHub repository jukanntenn/glm-plan-usage (14 stars, last pushed 4mo ago), licensed MIT. It adds 20 tokens to every session and 404 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.