pytest
Skill by prowler-cloud
Gives AI assistants pytest patterns for writing and refactoring Python tests. It is for developers working on Python test suites, including Prowler's SDK, API and MCP server code.
Install pytest
Built from the published package, never by AI.
git clone --depth 1 https://github.com/prowler-cloud/prowler /tmp/prowler && mkdir -p ~/.claude/skills && cp -r /tmp/prowler/skills/pytest ~/.claude/skills/pytestRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/prowler-cloud/prowler /tmp/prowler && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/prowler/skills/pytest ~/.gemini/antigravity-cli/skills/pytestAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill is a reference for writing and refactoring Python tests with pytest. It covers basic test classes and assertions, fixtures with teardown and scopes, shared fixtures in conftest.py, and mocking with unittest.mock. It also shows parametrized tests, markers for skipping and filtering, and async test examples.
The skill is published by prowler-cloud and is scoped to the root, sdk and api components. It describes Prowler's test environment, including pytest-xdist for parallel runs, pytest-randomly for random test order, and pytest-env for fake AWS credentials. It also lists the uv run pytest commands used in the repository. The source points to the prowler-test-api and prowler-test-sdk skills for Prowler-specific conventions.
Written from the project's SKILL.md and checked against it.
What it can do
- Test structureShows how to write test classes with success and failure cases using pytest.raises.
- FixturesCovers fixtures with teardown, built-in tmp_path use, and module, class and session scopes.
- conftest.pyShows how to share fixtures across tests in a tests/conftest.py file.
- MockingShows patching with unittest.mock, setting return values and side effects, and using MagicMock.
- ParametrizeShows how to run one test against several input and expected output pairs.
- MarkersCovers custom markers, skip and skipif, and selecting tests with the -m option.
- Async testsShows async test functions and notes which Prowler test suite has pytest-asyncio installed.
- Test commandsLists uv run pytest options for verbose output, failfast, filtering, coverage and parallel runs.
What you need
- Python
- uv
Try asking
- Write pytest tests with fixtures for my user service class
- Parametrize a pytest test for email validation cases
- Mock an external client in a pytest test with unittest.mock
Good to know
- The asyncio marker does nothing in the SDK and API test suites.
- Tests must not depend on each other because test order is random.
- Prowler-specific API and SDK testing conventions are in separate skills.
Security check
B- Allowed to use Edit, Write, Bash without limitsIn
SKILL.md
Checked automatically: skills/pytest/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: ReadEditWriteGlobGrepBashWebFetchWebSearchTask
-
SKILL.md6 KB -
references/prowler-testing.md575 B
Alternatives to pytest
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
pytest: common questions
Does this skill cover Prowler API or SDK testing conventions?
Not in full. The source says those conventions are in the prowler-test-api and prowler-test-sdk skills, and links a reference for SDK patterns using moto and MagicMock.
Why does @pytest.mark.asyncio not work in the SDK or API tests?
Only mcp_server/ installs pytest-asyncio, with asyncio_mode set to auto. The SDK and API suites do not install it, so the marker has no effect there.
Why might tests fail when run in a different order?
The Prowler environment uses pytest-randomly, which runs tests in random order each run. Tests must not depend on each other, and -p no:randomly can reproduce an ordering bug.
How do I install pytest?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is pytest free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is pytest safe to use?
It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (allowed to use edit, write, bash without limits). Review the code before you install. How grades work.
What are alternatives to pytest?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
