asarchami/dotfiles/python-testing

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Designs and implements pytest test suites for Python projects with fixtures, parametrization, mocking, coverage, and CI configuration. Use when creating tests, improving coverage, setting up testing infrastructure, or implementing property-based testing.

Install

npx vskill@latest install asarchami/dotfiles/python-testing

SKILL.md

Python Testing

Quick Start

bash
pytest # Run tests
pytest --cov=my_library # With coverage
pytest -x # Stop on first failure
pytest -k "test_encode" # Run matching tests

Pytest Configuration

toml
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-ra -q --cov=my_library --cov-fail-under=85"
[tool.coverage.run]
branch = true
source = ["src/my_library"]

Test Structure

tests/
├── conftest.py # Shared fixtures
├── test_encoding.py
└── test_decoding.py

Essential Patterns

Basic test:

python
def test_encode_valid_input():
result = encode(37.7749, -122.4194)
assert isinstance(result, str)
assert len(result) == 12

Parametrization:

python
@pytest.mark.parametrize("lat,lon,expected", [
(37.7749, -122.4194, "9q8yy"),
(40.7128, -74.0060, "dr5ru"),
])
def test_known_values(lat, lon, expected):
assert encode(lat, lon, precision=5) == expected

Fixtures:

python
@pytest.fixture
def sample_data():
return [(37.7749, -122.4194), (40.7128, -74.0060)]
def test_batch(sample_data):
results = batch_encode(sample_data)
assert len(results) == 2

Mocking:

python
def test_api_call(mocker):
mocker.patch("my_lib.client.fetch", return_value={"data": []})
result = my_lib.get_data()
assert result == []

Exception testing:

python
def test_invalid_raises():
with pytest.raises(ValueError, match="latitude"):
encode(91.0, 0.0)

Test Principles

PrincipleMeaning
IndependentNo shared state between tests
DeterministicSame result every run
FastUnit tests < 100ms each
FocusedTest behavior, not implementation

Checklist

Testing:
- [ ] Tests exist for public API
- [ ] Edge cases covered (empty, boundary, error)
- [ ] No external service dependencies (mock them)
- [ ] Coverage > 85%
- [ ] Tests run in CI

Cross-References

  • python-hypothesis — property-based testing with Hypothesis
  • python-mutation-testing — test suite strength via mutation analysis
  • python-code-quality — ruff, mypy, Pythonic idioms

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
Repository forks
2
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/asarchami/dotfiles/python-testing/badge)](https://verified-skill.com/skills/asarchami/dotfiles/python-testing)

Something wrong with this skill or its page? Tell us.