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

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.

agentmods
npx agentmods add skills/jukanntenn/glm-plan-usage/pytest
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00020 $0.00404
Opus 5 $0.00010 $0.00202
Sonnet 5 $0.00004 $0.00081
Haiku 4.5 $0.00002 $0.00040

Measured 4d ago against content hash badfc1272ceb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 4d 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. 4d 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 (13 stars, last pushed 2mo ago), licensed MIT. It adds 20 tokens to every session and 404 once invoked, about $0.0001 per session on Opus 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.

Related

Other skills, from other repositories

run-helix-tests

Submit and monitor .NET MAUI unit tests on Helix infrastructure. Supports running XAML, Resizetizer, Core, Essentials, and other unit test projects on distributed Helix queues.

dotnet/maui · 45 tokens

nunit-testing

Use when writing or modifying tests in NUnit's own test projects, or when making a behavioral change to production code that needs test coverage. Covers test structure, attribute choice, helper visibility, platform guards, and which test projects are real.

nunit/nunit · 51 tokens

dart-test

DART Test: unit tests, integration tests, CI validation, and debugging.

dartsim/dart · 18 tokens

browserless-test

Creates Vaadin Browserless server-side unit tests for Vaadin views covering navigation, component interactions, form validation, grid operations, and notifications. Use when the user asks to "write Browserless tests", "write Vaadin UI unit tests", "unit test a Vaadin view without a browser", "create view tests with…

AI-Unified-Process/marketplace · 104 tokens

junit-5-skill

Generates production-grade JUnit 5 unit and integration tests in Java. Covers assertions, parameterized tests, lifecycle hooks, mocking with Mockito, and nested tests. Use when user mentions "JUnit", "JUnit 5", "@Test", "assertEquals", "Assertions", "Java unit test". Triggers on: "JUnit", "@Test", "assertEquals"…

LambdaTest/agent-skills · 90 tokens

smoke-test-ml-pipeline

Owns the smoke test contract for an ML experiment: a small, diagnostic-by-construction pytest that fits the experiment's learner on a portion of the real data/ source and predicts on a disjoint portion that deliberately carries no pre-history buffer. The assertion is structural — the number of predictions must equal…

probabl-ai/skills · 486 tokens