claude-code/claude-zh/rules/python/testing.md

647 B
Raw Blame History

paths
**/*.py
**/*.pyi

Python 測試 (Testing)

本檔案擴展了 common/testing.md,包含 Python 特定內容。

框架 (Framework)

使用 pytest 作為測試框架。

覆蓋率 (Coverage)

pytest --cov=src --cov-report=term-missing

測試組織 (Test Organization)

使用 pytest.mark 進行測試分類:

import pytest

@pytest.mark.unit
def test_calculate_total():
    ...

@pytest.mark.integration
def test_database_connection():
    ...

參考資源

參見技能 (Skill)python-testing,獲取詳細的 pytest 模式與 Fixtures。