skills/bossjones/pytest-recording/SKILL.md
Work with pytest-recording (VCR.py) for recording and replaying HTTP interactions in tests. Use when writing VCR tests, managing cassettes, configuring VCR options, filtering sensitive data, or debugging recorded HTTP responses.
npx skillsauth add aiskillstore/marketplace pytest-recordingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
pytest-recording wraps VCR.py to record HTTP interactions as YAML cassettes, enabling deterministic tests without live API calls.
# Run all tests (uses existing cassettes)
uv run pytest tests/
# Run a single test
uv run pytest tests/test_module.py::test_function
# Rewrite all cassettes with fresh responses
uv run pytest tests/ --vcr-record=rewrite
# Record only missing cassettes
uv run pytest tests/ --vcr-record=new_episodes
# Disable VCR (make live requests)
uv run pytest tests/ --disable-recording
| Mode | Flag | Behavior |
|------|------|----------|
| none | --vcr-record=none | Only replay, fail if no cassette |
| once | (default) | Record if no cassette exists |
| new_episodes | --vcr-record=new_episodes | Record new requests, keep existing |
| all | --vcr-record=all | Always record, overwrite existing |
| rewrite | --vcr-record=rewrite | Delete and re-record all cassettes |
Basic test with VCR:
import pytest
@pytest.mark.vcr()
def test_api_call():
response = my_api_function()
assert response.status_code == 200
Custom cassette name:
@pytest.mark.vcr("custom_cassette_name.yaml")
def test_with_custom_cassette():
pass
Multiple cassettes:
@pytest.mark.vcr("cassette1.yaml", "cassette2.yaml")
def test_with_multiple_cassettes():
pass
The vcr_config fixture controls VCR behavior:
@pytest.fixture(scope="module")
def vcr_config():
return {
# Filter sensitive headers from recordings
"filter_headers": ["authorization", "api-key", "x-api-key"],
# Filter query parameters
"filter_query_parameters": ["key", "api_key", "token"],
# Match requests by these criteria
"match_on": ["method", "scheme", "host", "port", "path", "query"],
# Ignore certain hosts (don't record)
"ignore_hosts": ["localhost", "127.0.0.1"],
# Record mode
"record_mode": "once",
}
For LLM providers, filter authentication:
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [
"authorization", # OpenAI, Anthropic
"api-key", # Azure OpenAI
"x-api-key", # Anthropic
"x-goog-api-key", # Google AI
],
"filter_query_parameters": ["key"],
}
Use pytest_recording_configure for advanced processing:
def pytest_recording_configure(config, vcr):
vcr.serializer = "yaml"
vcr.decode_compressed_response = True
# Sanitize response headers
def sanitize_response(response):
response['headers']['Set-Cookie'] = 'REDACTED'
return response
vcr.before_record_response = sanitize_response
Cassettes are stored in tests/cassettes/ by default, organized by test module:
tests/
├── cassettes/
│ └── test_module/
│ └── test_function.yaml
└── test_module.py
If tests fail with "Can't find cassette":
--vcr-record=once to create missing cassettesIf VCR can't match requests:
match_on criteria in vcr_config--vcr-record=new_episodes to add missing interactionsWhen API responses change:
--vcr-record=rewrite to refresh all cassettes# View a cassette file
cat tests/cassettes/test_module/test_function.yaml
# Search for specific content in cassettes
grep -r "error" tests/cassettes/
When adding a new provider:
filter_headers in vcr_configfilter_query_parameters--vcr-record=once to create cassettesCommon provider authentication:
| Provider | Headers to Filter |
|----------|-------------------|
| OpenAI | authorization |
| Anthropic | x-api-key, authorization |
| Azure OpenAI | api-key |
| Google AI | x-goog-api-key |
| Cohere | authorization |
scope="module" for shared fixturesdevelopment
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.