Skip to main content

testing

Testing conventions using pytest. Use when writing tests, creating fixtures, or running test suites.

소스 정보

저장소
meleantonio/ChernyCode
최근 소스 활동
2026년 2월 1일 11:23
감지된 SKILL.md 언어
영어
스타
519
포크
107

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
testing
description
Testing conventions using pytest. Use when writing tests, creating fixtures, or running test suites.
# Testing Standards ## Framework - Use pytest for all tests - Target 80%+ code coverage ## File Organization - Tests in `tests/` directory mirroring `src/` structure - Test files: `test_<module>.py` or `<module>_test.py` - Test functions: `test_<description>` ## Fixtures - Use fixtures for reusable test data - Prefer `scope="function"` unless shared state is needed - Use `conftest.py` for shared fixtures Example: ```python import pytest @pytest.fixture def sample_user(): """Create a sample user for testing.""" return User(name="Test User", email="test@example.com") def test_user_creation(sample_user): assert sample_user.name == "Test User" assert sample_user.email == "test@example.com" ``` ## Parametrization - Use `@pytest.mark.parametrize` for testing multiple inputs - Keep parameter names descriptive Example: ```python @pytest.mark.parametrize("input_val,expected", [ (1, 2), (2, 4), (0, 0), ]) def test_double(input_val, expected): assert double(input_val) == expected ``` ## Assertions - Use plain `assert` statements - Write clear assertion messages for complex checks - Test one concept per test function ## Mocking - Use `pytest-mock` or `unittest.mock` - Mock external dependencies (APIs, databases) - Avoid mocking the code under test ## Commands - Run tests: `pytest` - With coverage: `pytest --cov` - Verbose: `pytest -v` - Single file: `pytest tests/test_specific.py` - Single test: `pytest tests/test_specific.py::test_name`
GitHub에서 보기