agentleFS
jscott3201jscott3201/yet-more-skills/skills/python-pytest/SKILL.md

python-pytest

Skill4 starsChanged 2 months agoApache-2.0View on GitHub

Select, run, configure, or diagnose Python tests with pytest. Covers collection, plugins, asyncio scopes, resource isolation, installed-package imports, and truthful results; not test design alone.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If collection changes unexpectedly, inspect loaded plugins and configuration.

    line 21
  2. Distinctive:

    Keep pytest-asyncio strict/auto mode intentional.

    line 25
  3. Distinctive:

    Read commands and pitfalls before changing runner configuration.

    line 31

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Pytest

Inspect the project's pytest version, configuration, conftest.py files, plugins, testpaths, and interpreter before choosing a command. Preserve existing modes and gate scripts. Do not assume latest-only flags or that pytest-xdist, pytest-asyncio, coverage, or timeout plugins are installed.

Select tests deliberately

Use explicit paths or node IDs for a focused change and --collect-only -q when discovery is uncertain. Reuse the same config, markers, and selection for collection and execution. Expand to relevant consumers, then the intended gate. --lf is useful feedback, not evidence that a changed surface is covered.

Distinguish failures, collection errors, deselection, skips, xfails, and passes. Exit code 5 means no tests collected; do not convert it to success in a required lane. A zero exit with all required tests skipped is not a pass for the promised feature. An expected failure needs a bounded reason and strict unexpected-pass handling where supported. Never add retries or importorskip to hide a missing required extension.

Control imports and plugins

Run with the selected interpreter (python -m pytest or the existing project runner). That alone does not prevent source shadowing. For artifact evidence, use a clean environment and a working directory outside the checkout, inspect the imported module origin, and inspect any conftest/pythonpath manipulation. --import-mode=importlib is useful where compatible but not magic isolation.

If collection changes unexpectedly, inspect loaded plugins and configuration. Disabling plugin autoload is a diagnostic option, not a default fix: explicitly load required plugins when doing so. Do not remove a warnings policy to silence unawaited coroutines or resource leaks.

Async and parallel execution

Keep pytest-asyncio strict/auto mode intentional. Async fixture caching scope and loop scope are different; the loop must outlive loop-bound resources and cleanup. Verify the installed plugin's supported syntax instead of pasting obsolete event_loop fixture overrides.

Use xdist only when fixtures and resources are safe to parallelize. A session fixture may run once per worker, not once globally. Isolate ports, filesystem paths, databases, interpreter state, and native runtimes. Start serially when diagnosing order sensitivity. Do not run latency benchmarks with workers or competing Cargo builds.

Return the exact command, environment, selected/collected and executed scope, outcomes, and untested lanes. A required native test lane should fail clearly when its module is absent.

Read commands and pitfalls before changing runner configuration.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.