python-testing-patterns

python-testing-patterns is a skill for Claude Code, Codex from sagar-shirwalkar/servicenow-atlas. It costs 44 tokens per session (878 once invoked), scanned A, original, Apache-2.0.

A set of pytest conventions for the Atlas project, including test setup, shared fixtures, mocks for external services, and smoke tests.

In plain words
What is it for?
Writing or debugging unit and integration tests, setting up test infrastructure, creating fixtures, mocking external dependencies, and running smoke tests.
Why use it?
It gives tests a consistent structure and helps keep them from contacting services such as Hugging Face or the network unexpectedly.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

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/sagar-shirwalkar/servicenow-atlas/python-testing-patterns
Any agent
npx skills add sagar-shirwalkar/servicenow-atlas --skill python-testing-patterns
Clone the repo
git clone --depth 1 https://github.com/sagar-shirwalkar/servicenow-atlas

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 python-testing-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/sagar-shirwalkar/servicenow-atlas/python-testing-patterns.svg)](https://agentmods.dev/skills/sagar-shirwalkar/servicenow-atlas/python-testing-patterns)
Your own site
<a href="https://agentmods.dev/skills/sagar-shirwalkar/servicenow-atlas/python-testing-patterns"><img src="https://agentmods.dev/badge/skills/sagar-shirwalkar/servicenow-atlas/python-testing-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 878 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.1 $0.00044 $0.00878
Opus 5 $0.00022 $0.00439
Sonnet 5 $0.00009 $0.00176
Haiku 4.5 $0.00004 $0.00088

Measured 5d ago against content hash 8d674892825f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

python-testing-patterns 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 5d 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.

.agents/skills/python-testing-patterns/SKILL.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

When to use

  • Writing unit or integration tests for the project
  • Setting up test infrastructure (conftest.py, fixtures)
  • Adding tests for a new module
  • Debugging a failing test

Prerequisites

Tests require the dev dependencies:

uv sync --extra dev

Test structure

Tests live in tests/ at the project root, mirroring atlas/:

tests/
├── conftest.py          # Shared fixtures
├── test_chunk.py        # Tests for atlas/chunk.py
├── test_make_bundle.py  # Tests for atlas/make_bundle.py
└── test_embed/
    ├── conftest.py      # Embedder fixtures
    └── test_onnx.py     # Tests for atlas/embed/onnx.py

Fixture patterns

Use conftest.py for shared fixtures. Keep them scoped appropriately.

tests/conftest.py

from __future__ import annotations

from collections.abc import Generator
from pathlib import Path
import tempfile

import pytest


@pytest.fixture
def tmp_bundle_dir() -> Generator[Path, None, None]:
    """Provide a temporary directory for bundle output."""
    with tempfile.TemporaryDirectory() as d:
        yield Path(d)

Mocking external dependencies

For tests that should not hit Hugging Face or the network:

@pytest.fixture(autouse=True)
def mock_hf_download(monkeypatch: pytest.MonkeyPatch) -> None:
    """Prevent accidental network calls during tests."""

    def fake_download(*args, **kwargs) -> str:
        return "/tmp/fake-model-dir"

    monkeypatch.setattr(
        "huggingface_hub.snapshot_download",
        fake_download,
    )

For tests that need real ONNX inference, mark them as integration:

@pytest.mark.integration
def test_onnx_embedder_inference(onnx_embedder: OnnxEmbedder) -> None:
    embeddings = onnx_embedder.embed(["hello world"])
    assert embeddings.shape[1] == onnx_embedder.dim

Test patterns by module

atlas/chunk.py

  • Unit test parse_frontmatter with: valid YAML, malformed YAML, no frontmatter, empty file.
  • Unit test _split_on_h2 with: normal headings, no headings, consecutive headings, heading at EOF.
  • Integration test chunk_file against a real markdown file in tests/fixtures/.

Read the full file on GitHub · 134 lines

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. 5d ago First seen · 134 lines · 44 tokens per session scan A 8d674892825f

Subscribe to this mod's changes

python-testing-patterns is a skill published in the GitHub repository sagar-shirwalkar/servicenow-atlas (2 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 44 tokens to every session and 878 once invoked, about $0.0002 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-31.

Related

Other skills, from other repositories

testing-python-pytest

Generates professional pytest unit test suites for Python source files, ensuring >90% line and branch coverage per file. Analyzes modules with AST inspection to discover all classes, methods, and functions, then produces well-structured tests following the AAA pattern with fixtures, parametrize, mocking, and…

jenreh/appkit-bpmn-server · 124 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

testing-python

Write and evaluate effective Python tests using pytest. Use when writing tests, reviewing test code, debugging test failures, or improving test coverage. Covers test design, fixtures, parameterization, mocking, and async testing.

PrefectHQ/fastmcp · 45 tokens

idapython

IDA Pro Python scripting for reverse engineering. Use when writing IDAPython scripts, analyzing binaries, working with IDA's API for disassembly, decompilation (Hex-Rays), type systems, cross-references, functions, segments, or any IDA database manipulation. Covers ida modules (50+), idautils iterators, and common…

mrexodia/ida-pro-mcp · 77 tokens

python-playground

Run and test Python code in a dedicated playground directory. Use when you need to execute Python scripts, test code snippets, investigate CPython behavior, or experiment with Python without affecting the main codebase.

pydantic/monty · 44 tokens

review-usability

Check whether the common Python code an LLM would plausibly write still works on this branch, testing real cases in ./playground against CPython. Use to find behaviour that diverges from CPython or trips up ordinary idiomatic code.

pydantic/monty · 52 tokens