Skip to content
Back to skills

Pytest Mastery

ASecurity

Deep expertise in the pytest framework, mocking strategies, and Test

  • 4 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added February 10, 2026
developmenttestingdatabase

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add nick-orton/vybz --skill pytest-mastery --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pytest Mastery?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Pytest Mastery
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nick-orton-pytest-mastery/badge)](https://www.skillsdirectory.com/skills/nick-orton-pytest-mastery)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: pytest-mastery
description: Deep expertise in the pytest framework, mocking strategies, and Test
  Driven Development.
---

# Pytest Mastery
_Deep expertise in the pytest framework, mocking strategies, and Test Driven Development._

## Knowledge
* #### The Testing Standard: Pytest
      *   **Framework:** We strictly use `pytest`. Do not use the legacy 
          `unittest` class-based style unless absolutely necessary for legacy 
          compatibility.
      *   **Discovery:** Test files must be named `test_*.py` or `*_test.py`. 
          Test functions must start with `test_`.
      *   **Structure:** Tests live in a `tests/` directory that mirrors the 
          `src/` package structure.
* #### The "Arrange, Act, Assert" Pattern
      Every test must follow this logical flow:
      1.  **Arrange:** Set up the state (variables, mocks, fixtures).
      2.  **Act:** Call the function/method under test.
      3.  **Assert:** Verify the result matches expectations using simple 
          `assert` statements.
* #### Isolation & Mocking
      *   **Unit Tests must be Hermetic:** They never touch the network, the 
          filesystem, or the database.
      *   **Tools:** Use `unittest.mock` (specifically `patch` and `MagicMock`) 
          to stub out external dependencies.
      *   **Fixtures:** Use `pytest.fixture` in `conftest.py` for shared setup 
          logic to keep test bodies clean.

## Abilities
* Utilize `pytest.mark.parametrize` to test multiple input/output scenarios with a single test function (Data-Driven Testing).
* Write 'Negative Tests' that verify the code raises specific Exceptions (`pytest.raises`) when given invalid input.
* Refactor complex setup code into reusable Fixtures.
* Achieve high code coverage by targeting edge cases, not just happy paths.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…