Chuyển đến nội dung
Skillpedia
Kiểm thử48k · #5553

python-testing-patterns

Skill này làm gì

Hướng dẫn này chỉ cách kiểm thử code Python một cách toàn diện. Nó bao gồm các kỹ thuật như dùng “pytest”, tạo “fixtures” (thiết lập sẵn), “mocking” (mô phỏng một phần code) và phát triển theo Test-Driven Development (TDD).

Khi nào nên dùng

  • ✓Khi viết test cho code Python.
  • ✓Khi thiết lập và tổ chức bộ test.
  • ✓Khi làm theo thực hành TDD trong phát triển.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/python-testing-patterns/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/python-testing-patterns/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để viết test cho một hàm Python tính trung bình cộng của một danh sách?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

AI dùng hướng dẫn này để minh họa cách viết test Python hiệu quả. Nó giải thích cách dùng các công cụ như pytest và kỹ thuật mô phỏng phụ thuộc, giúp đảm bảo code chạy đúng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Python Testing Patterns

Comprehensive guide to implementing robust testing strategies in Python using pytest, fixtures, mocking, parameterization, and test-driven development practices.

Use this skill when

  • Writing unit tests for Python code
  • Setting up test suites and test infrastructure
  • Implementing test-driven development (TDD)
  • Creating integration tests for APIs and services
  • Mocking external dependencies and services
  • Testing async code and concurrent operations
  • Setting up continuous testing in CI/CD
  • Implementing property-based testing
  • Testing database operations
  • Debugging failing tests

Do not use this skill when

  • The task is unrelated to python testing patterns
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.
  • If detailed examples are required, open resources/implementation-playbook.md.

Resources

  • resources/implementation-playbook.md for detailed patterns and examples.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Câu hỏi thường gặp

“pytest” là gì?

“pytest” là công cụ phổ biến giúp việc viết test cho code Python dễ dàng hơn.

“Fixtures” là gì?

“Fixtures” là các thiết lập ban đầu bạn có thể tái sử dụng cho nhiều test để chuẩn bị môi trường kiểm thử.

“Mocking” là gì?

“Mocking” là kỹ thuật mô phỏng một phần code hoặc dịch vụ bên ngoài mà code của bạn phụ thuộc vào, để kiểm thử các đơn vị một cách độc lập.

Chi tiết

Mô tả gốc của tác giả

Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5553
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự