Agent skill

Pytest

by mathiasertl in mathiasertl/django-ca

Instructions for running, writing, and maintaining tests in this project

GPL-3.0Auto-check passedTesting & QA

Install Pytest

skills CLI
$ npx skills add mathiasertl/django-ca --skill pytest -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mathiasertl/django-ca pytest --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mathiasertl/django-ca.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.opencode/skills/pytest .claude/skills/pytest && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
pytest
GitHub stars
158
Token cost
~924 tokens
SKILL.md length
400 words
Files
1
Skills in repo
2
Repo updated
First seen
Licence
GPL-3.0

At a glance

Instructions for running, writing, and maintaining tests in this project

  • Tasks that involve Unit testing
  • SKILL.md covers Running tests, Critical test quirks, Test environment conventions and Writing tests
  • Calls uv and apt-get
  • Tasks that involve Cryptography

What it does

Pytest is an agent skill from mathiasertl/django-ca. Instructions for running, writing, and maintaining tests in this project

Its SKILL.md is about 920 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing, Cryptography and Backend development. It works with pytest, Django, Python and Pydantic. The repository describes itself as: A TLS certificate authority with CRL, OCSP, HSM and ACMEv2 support and more. The licence is GPL-3.0.

When your agent uses it

  • Tasks that involve Unit testing
  • Tasks that involve Cryptography
  • Tasks that involve Backend development

Example prompts

  • “Use the pytest skill to instruction for running, writing, and maintaining tests in this project”
  • “/pytest”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit feabb70. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • uv
    • apt-get

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use uv, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Pytest loads about 924 tokens when it runs. Until then it costs about 20 tokens; SKILL.md has 400 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~20
When it runs · the whole SKILL.md, loaded when a task matches
~924

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mathiasertl/django-ca at commit feabb70, republished under its GPL-3.0 licence (© mathiasertl). 400 words, ~924 tokens.

Download SKILL.mdSave it as .claude/skills/pytest/SKILL.md (or your agent's skills folder).
name
pytest
description
Instructions for running, writing, and maintaining tests in this project

Running tests

bash
uv run pytest --no-selenium                       # all tests with coverage (slow)
uv run pytest --no-selenium --no-cov               # skip coverage (much faster for local work)
uv run pytest ca/django_ca/tests/test_models.py           # single file
uv run pytest ca/django_ca/tests/test_models.py::Cls::method  # single test
uv run pytest -k "test_something"    # keyword filter

When writing/updating tests, it is sufficient to test the added/updated tests. When updating fixtures, you can also only run the affected module.

Critical test quirks

  • --cov-fail-under=100 is in addopts — 100% coverage is enforced by default. New code must be covered or use # pragma: no cover (version-conditional variants like # pragma: only cryptography>46 also exist).
  • Tests run in random order by default (pytest-random-order).
  • DJANGO_SETTINGS_MODULE=ca.test_settings is set automatically by pytest-env.
  • ca/ and docs/source/ are on pythonpath via pytest config — no need to set PYTHONPATH manually when running pytest.
  • cert-data.json is loaded at test_settings.py import time; it must exist before any test run. Regenerate with uv run python dev.py recreate-fixtures.
  • Selenium tests auto-skip unless on newest Python + cryptography + pydantic combo. Require Firefox + contrib/selenium/geckodriver.
  • HSM tests require softhsm2 (apt-get install softhsm2). Skip locally: --no-hsm.
  • Crypto-related tests use pre-generated fixtures in ca/django_ca/tests/
  • Do not regenerate fixtures unless explicitly asked.

Test environment conventions

  • COLUMNS=80 is set in pytest env to make argparse output deterministic.
  • Pydantic models pre-imported in pytest_sessionstart to avoid freezegun/Pydantic metaclass conflicts — do not move that import.
  • CA_DIR = "/non/existent" in test settings — tests needing a real CA dir must use override_settings or a temp-dir fixture.

Writing tests

  • Tests are defined in ca/django_ca/tests/.
  • Tests are grouped into submodules, e.g. ca/django_ca/tests/models/test_<model>.py for Django models.
  • New tests are implemented as pytest-style functions, not unittest.TestCase classes.
  • Class based unit tests are allowed for grouping, but pytest fixtures should be used instead of setUp/ tearDown.
Show full SKILL.md (163 more words)Show less
Fixtures

This section provides generic instructions how to use fixtures.

  • Always use pytest fixtures instead of setUp/tearDown-style functions.

  • Globally available fixtures are defined in ca/django_ca/tests/base/fixtures.py.

  • Fixtures required only by special cases (e.g. a special HTTP client used in many admin tests), define it in a conftest.py in the test submodule. If only a single test_*.py file needs it, define it in that file.

  • A constant instead of a fixture can be used for trivial values, never change and are not stored in the database. Store them in ca/django_ca/tests/base/constants.py in this case.

  • When using fixtures in the function definition, please use the following order:

    1. Standard pytest fixtures (e.g. tmpdir).
    2. Fixtures defined by plugins (e.g. db, settings, client).
    3. Fixtures defined in conftest.py (e.g. db, settings, client).
  • If a fixture value only needs to be requested, use request.getfixturevalue("fixture_name") instead of adding it to the function signature to avoid linter warnings.

  • The project defines a few dynamically created fixtures, they are documented in /home/mertl/git/mati/django-ca/docs/source/dev/testing.rst.

© mathiasertl, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .opencode/skills/pytest of mathiasertl/django-ca.

Open the folder on GitHubat commit feabb70

Compare with similar skills

Pytest next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Pytest compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Pytest this skillmathiasertl/django-ca158—~924Automated safety check: PassGPL-3.0
Maintaining Python TestsPostHog/posthog-foss721—~2.5kAutomated safety check: PassMIT
Pytestbobmatnyc/claude-mpm155—~8.2kAutomated safety check: PassMIT
Run And Verifyaropan/clist439—~461Automated safety check: PassApache-2.0
Python Devdoccker/cc-use-exp1.1k—~790Automated safety check: PassCustom licence
PythonMadAppGang/claude-code283—~2.8kAutomated safety check: NotesMIT

Similar skills

  • Maintaining Python Tests

    PostHog/posthog-foss

    Official

    Maintains existing pytest and Django test suites without weakening correctness.

    721 GitHub stars~2.5k tokensUpdated today
    Testing & QAAuto-check passed
  • Pytest

    bobmatnyc/claude-mpm

    pytest - Python's most powerful testing framework with fixtures, parametrization, plugins, and framework integration for FastAPI, Django, Flask

    155 GitHub stars~8.2k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed
  • Run And Verify

    aropan/clist

    Choose and run focused checks after changing CLIST Python code: Django tests, standalone pytest tests, offline parser fixtures, Ruff, or a relevant management-command check.

    439 GitHub stars~461 tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • Python Dev

    doccker/cc-use-exp

    Python 开发规范。当用户操作 .py、pyproject.toml、requirements.txt、setup.py 文件, 或涉及 FastAPI、Django、Flask、pytest、asyncio 开发时触发。

    1.1k GitHub stars~790 tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Python

    MadAppGang/claude-code

    A skill your agent uses when building FastAPI applications, implementing async endpoints, setting up Pydantic schemas, working with SQLAlchemy, or writing pytest tests for Python backend services.

    283 GitHub stars~2.8k tokensUpdated 6 mo ago
    Backend & APIsAuto-check: notes
  • Mastering Python Skill

    SpillwaveSolutions/agent-brain

    Modern Python coaching covering language foundations through advanced production patterns.

    120 GitHub stars~1.4k tokensUpdated 18 days ago
    DevelopmentAuto-check: notes

More from mathiasertl/django-ca

  • Liveserver

    mathiasertl/django-ca

    Start a local Django development server and make HTTP requests against it for interactive endpoint testing

    158 GitHub stars~977 tokensUpdated 3 days ago
    Auto-check passed

Categories

Questions about Pytest

What does Pytest do?

Instructions for running, writing, and maintaining tests in this project. Pytest is an agent skill from mathiasertl/django-ca.

When should I use Pytest?

Pytest fits situations like: tasks that involve Unit testing; tasks that involve Cryptography; tasks that involve Backend development.

How do I install Pytest in Claude Code?

Run `npx skills add mathiasertl/django-ca --skill pytest -a claude-code`. Or copy the skill folder (.opencode/skills/pytest in mathiasertl/django-ca) into .claude/skills/pytest in your project. Claude Code loads it when a task matches its description.

How do I install Pytest in Codex?

Run `npx skills add mathiasertl/django-ca --skill pytest -a codex`. Or copy the skill folder (.opencode/skills/pytest in mathiasertl/django-ca) into .agents/skills/pytest in your project. Codex loads it when a task matches its description.

Can I use Pytest in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mathiasertl/django-ca --skill pytest -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pytest, .gemini/skills/pytest, .github/skills/pytest and .opencode/skills/pytest in your project.

What does Pytest need to run?

Going by SKILL.md and its folder, Pytest needs the command-line tools its instructions call (uv and apt-get). Our summary lists: Python 3.

Does Pytest access the network?

SKILL.md contains no URLs. Its commands use uv, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Pytest safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Pytest use?

Pytest is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Pytest use?

About 924 tokens (SKILL.md is roughly 3.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Pytest?

Skills that share tags, products or a category with Pytest: Maintaining Python Tests (PostHog/posthog-foss, 721 stars), Pytest (bobmatnyc/claude-mpm, 155 stars), Run And Verify (aropan/clist, 439 stars) and Python Dev (doccker/cc-use-exp, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Pytest?

mathiasertl (a GitHub user) maintains it in mathiasertl/django-ca, which has 158 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on October 4, 2026.

Source: mathiasertl/django-ca on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.