一键导入
testing-workflow
Testing best practices with pytest. Use this skill when writing tests, setting up test infrastructure, or debugging test failures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Testing best practices with pytest. Use this skill when writing tests, setting up test infrastructure, or debugging test failures.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add and manage evaluation results in Hugging Face model cards. Supports extracting eval tables from README content, importing scores from Artificial Analysis API, and running custom model evaluations with vLLM/lighteval. Works with the model-index metadata format.
Structured approach to exploratory data analysis with pandas, matplotlib, and seaborn. Use this skill when analyzing new datasets, understanding distributions, or preparing data for modeling.
Machine learning pipeline development with scikit-learn. Use this skill for training models, cross-validation, hyperparameter tuning, and model evaluation.
Write comprehensive clinical reports including case reports (CARE guidelines), diagnostic reports (radiology/pathology/lab), clinical trial reports (ICH-E3, SAE, CSR), and patient documentation (SOAP, H&P, discharge summaries). Full support with templates, regulatory compliance (HIPAA, FDA, ICH-GCP), and validation tools.
Convert files and office documents to Markdown. Supports PDF, DOCX, PPTX, XLSX, images (with OCR), audio (with transcription), HTML, CSV, JSON, XML, ZIP, YouTube URLs, EPubs and more.
Generate concise (3-4 page), focused medical treatment plans in LaTeX/PDF format for all clinical specialties. Supports general medical treatment, rehabilitation therapy, mental health care, chronic disease management, perioperative care, and pain management. Includes SMART goal frameworks, evidence-based interventions with minimal text citations, regulatory compliance (HIPAA), and professional formatting. Prioritizes brevity and clinical actionability.
| name | testing-workflow |
| description | Testing best practices with pytest. Use this skill when writing tests, setting up test infrastructure, or debugging test failures. |
A comprehensive guide to writing and organizing tests with pytest.
project/
├── src/
│ └── mypackage/
│ ├── __init__.py
│ └── module.py
├── tests/
│ ├── __init__.py
│ ├── conftest.py # Shared fixtures
│ ├── test_module.py
│ └── integration/
│ └── test_api.py
├── pytest.ini
└── requirements-dev.txt
[pytest]
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts = -v --tb=short --cov=src --cov-report=term-missing
filterwarnings = ignore::DeprecationWarning
# tests/test_calculator.py
import pytest
from mypackage.calculator import Calculator
class TestCalculator:
def test_add_positive_numbers(self):
calc = Calculator()
assert calc.add(2, 3) == 5
def test_add_negative_numbers(self):
calc = Calculator()
assert calc.add(-1, -1) == -2
def test_divide_by_zero_raises_error(self):
calc = Calculator()
with pytest.raises(ZeroDivisionError):
calc.divide(10, 0)
# tests/conftest.py
import pytest
from mypackage.database import Database
@pytest.fixture
def db():
"""Provide a test database connection."""
db = Database(":memory:")
db.create_tables()
yield db
db.close()
@pytest.fixture
def sample_user(db):
"""Create a sample user for testing."""
user = db.create_user("test@example.com", "password123")
return user
import pytest
@pytest.mark.parametrize("input,expected", [
("hello", "HELLO"),
("World", "WORLD"),
("", ""),
("123", "123"),
])
def test_uppercase(input, expected):
assert input.upper() == expected
from unittest.mock import Mock, patch, MagicMock
import pytest
def test_api_call():
with patch('mypackage.api.requests.get') as mock_get:
mock_response = Mock()
mock_response.status_code = 200
mock_response.json.return_value = {"data": "test"}
mock_get.return_value = mock_response
result = api.fetch_data()
assert result == {"data": "test"}
mock_get.assert_called_once()
import pytest
import asyncio
@pytest.mark.asyncio
async def test_async_function():
result = await some_async_function()
assert result == expected_value
# Run all tests
pytest
# Run specific file
pytest tests/test_module.py
# Run specific test
pytest tests/test_module.py::test_function
# Run with coverage
pytest --cov=src --cov-report=html
# Run only fast tests
pytest -m "not slow"
# Run with verbose output
pytest -v
# Stop on first failure
pytest -x
test_user_login_with_invalid_password_returns_401