async-python-testing

Test asynchronous Python code with pytest-asyncio patterns for AOS components.

2|1|Updated Mar 19, 2025
One-click install
npx skills add https://github.com/ASISaga/AgentOperatingSystem --skill async-python-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: async-python-testing
Source: https://github.com/ASISaga/AgentOperatingSystem/tree/main/.github/skills/async-python-testing
Command: npx skills add https://github.com/ASISaga/AgentOperatingSystem --skill async-python-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and patterns for effectively testing asynchronous Python code, which is crucial for the reliable operation of the Agent Operating System.

Core Features & Use Cases

  • Async Test Patterns: Learn how to write, structure, and execute tests for async functions, generators, and context managers.
  • Mocking Async Code: Master techniques for mocking asynchronous calls and services, including Azure SDK components.
  • AOS Component Testing: Understand how to test core AOS components like perpetual agents, orchestrators, and message buses.
  • Use Case: When developing a new agent that interacts with Azure Blob Storage asynchronously, use this Skill to write robust tests that ensure correct data handling and error management without relying on live Azure services.

Quick Start

Write an async test for a function that fetches data by marking it with @pytest.mark.asyncio and using await.

Frequently Asked Questions about async-python-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test asynchronous Python functions with pytest?

Test asynchronous Python functions by marking them with `@pytest.mark.asyncio` and using `await` to execute and verify async calls within your test suite.

What is the best way to mock async Azure SDK calls in Python tests?

Mock async Azure SDK calls by patching asynchronous methods to return awaitable objects, allowing you to test Azure interactions without relying on live services.

How do I test async generators and context managers in Python?

Test async generators and context managers by using specialized async iteration patterns and `async with` statements to verify their setup, execution, and teardown behaviors.

Can I test AOS components like orchestrators and perpetual agents?

Yes, you can test AOS components like perpetual agents and orchestrators by applying specific async mocking patterns to verify message bus interactions and orchestration logic.

Why does my async Python test hang or skip execution?

Async Python tests hang or skip when missing the `pytest-asyncio` integration or the `@pytest.mark.asyncio` decorator, preventing the test runner from properly awaiting coroutines.