[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F0B3JAN30PJQ7RNEXZP4MQ":3,"skill-same:01M7F0B3JAN30PJQ7RNEXZP4MQ":65},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7F0B3JAN30PJQ7RNEXZP4MQ","temporal-python-testing",null,"Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.","shotcowboystyle\u002Fag-skills","shotcowboystyle","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F62471?v=4","01M7EZTCFCZJ6K3MYW8BPM4X6R","Curtis Blanton","01M7EZTCG1S5M04J90A931X9BX",0,"MIT","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fbackend-development\u002Fskills\u002Ftemporal-python-testing\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: temporal-python-testing\ndescription: Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.\nlast_verified: 2026-10-27\n---\n\n# Temporal Python Testing Strategies\n\nComprehensive testing approaches for Temporal workflows using pytest, progressive disclosure resources for specific testing scenarios.\n\n## When to Use This Skill\n\n- **Unit testing workflows** - Fast tests with time-skipping\n- **Integration testing** - Workflows with mocked activities\n- **Replay testing** - Validate determinism against production histories\n- **Local development** - Set up Temporal server and pytest\n- **CI\u002FCD integration** - Automated testing pipelines\n- **Coverage strategies** - Cover every workflow decision path\n\n## Testing Philosophy\n\n**Recommended Approach** (Source: docs.temporal.io\u002Fdevelop\u002Fpython\u002Ftesting-suite):\n\n- Write majority as integration tests\n- Use pytest with async fixtures\n- Time-skipping enables fast feedback (month-long workflows → seconds)\n- Mock activities to isolate workflow logic\n- Validate determinism with replay testing\n\n**Three Test Types**:\n\n1. **Unit**: Workflows with time-skipping, activities with ActivityEnvironment\n2. **Integration**: Workers with mocked activities\n3. **End-to-end**: Full Temporal server with real activities (use sparingly)\n\n## Available Resources\n\nThis skill provides detailed guidance through progressive disclosure. Load specific resources based on your testing needs:\n\n### Unit Testing Resources\n\n**File**: `resources\u002Funit-testing.md`\n**When to load**: Testing individual workflows or activities in isolation\n**Contains**:\n\n- WorkflowEnvironment with time-skipping\n- ActivityEnvironment for activity testing\n- Fast execution of long-running workflows\n- Manual time advancement patterns\n- pytest fixtures and patterns\n\n### Integration Testing Resources\n\n**File**: `resources\u002Fintegration-testing.md`\n**When to load**: Testing workflows with mocked external dependencies\n**Contains**:\n\n- Activity mocking strategies\n- Error injection patterns\n- Multi-activity workflow testing\n- Signal and query testing\n- Coverage strategies\n\n### Replay Testing Resources\n\n**File**: `resources\u002Freplay-testing.md`\n**When to load**: Validating determinism or deploying workflow changes\n**Contains**:\n\n- Determinism validation\n- Production history replay\n- CI\u002FCD integration patterns\n- Version compatibility testing\n\n### Local Development Resources\n\n**File**: `resources\u002Flocal-setup.md`\n**When to load**: Setting up development environment\n**Contains**:\n\n- Docker Compose configuration\n- pytest setup and configuration\n- Coverage tool integration\n- Development workflow\n\n## Quick Start Guide\n\n### Basic Workflow Test\n\nVerified against temporalio 1.34 and pytest-asyncio 1.x. Workflow classes must be\ndefined at module level; the SDK rejects a `@workflow.defn` class inside a function.\n\n```python\nimport pytest\nimport pytest_asyncio\nfrom temporalio.testing import WorkflowEnvironment\nfrom temporalio.worker import Worker\n\n# Strict mode (the pytest-asyncio default) needs @pytest_asyncio.fixture for\n# async fixtures; with asyncio_mode = auto, plain @pytest.fixture also works\n@pytest_asyncio.fixture\nasync def workflow_env():\n    env = await WorkflowEnvironment.start_time_skipping()\n    yield env\n    await env.shutdown()\n\n@pytest.mark.asyncio\nasync def test_workflow(workflow_env):\n    async with Worker(\n        workflow_env.client,\n        task_queue=\"test-queue\",\n        workflows=[YourWorkflow],\n        activities=[your_activity],\n    ):\n        result = await workflow_env.client.execute_workflow(\n            YourWorkflow.run,\n            args,\n            id=\"test-wf-id\",\n            task_queue=\"test-queue\",\n        )\n        assert result == expected\n```\n\n### Basic Activity Test\n\n```python\nfrom temporalio.testing import ActivityEnvironment\n\n@pytest.mark.asyncio\nasync def test_activity():\n    env = ActivityEnvironment()\n    result = await env.run(your_activity, \"test-input\")\n    assert result == expected_output\n```\n\n## Coverage Targets\n\nTemporal's docs set no coverage percentage. Pick a `--cov-fail-under` threshold\nfor your team, and aim for:\n\n- **Workflows**: every decision branch exercised\n- **Activities**: success, retryable and non-retryable failure paths\n- **Integration**: Critical paths with mocked activities\n- **Replay**: All workflow versions before deployment\n\n## Key Testing Principles\n\n1. **Time-Skipping** - Month-long workflows test in seconds\n2. **Mock Activities** - Isolate workflow logic from external dependencies\n3. **Replay Testing** - Validate determinism before deployment\n4. **Branch Coverage** - Every path a production workflow can take\n5. **Fast Feedback** - Unit tests run in milliseconds\n\n## How to Use Resources\n\n**Load specific resource when needed**:\n\n- \"Show me unit testing patterns\" → Load `resources\u002Funit-testing.md`\n- \"How do I mock activities?\" → Load `resources\u002Fintegration-testing.md`\n- \"Setup local Temporal server\" → Load `resources\u002Flocal-setup.md`\n- \"Validate determinism\" → Load `resources\u002Freplay-testing.md`\n\n## Additional References\n\n- Python SDK Testing: docs.temporal.io\u002Fdevelop\u002Fpython\u002Ftesting-suite\n- Testing Patterns: github.com\u002Ftemporalio\u002Ftemporal\u002Fblob\u002Fmain\u002Fdocs\u002Fdevelopment\u002Ftesting.md\n- Python Samples: github.com\u002Ftemporalio\u002Fsamples-python\n","# Temporal Python Testing Strategies\n\nComprehensive testing approaches for Temporal workflows using pytest, progressive disclosure resources for specific testing scenarios.\n\n## When to Use This Skill\n\n- **Unit testing workflows** - Fast tests with time-skipping\n- **Integration testing** - Workflows with mocked activities\n- **Replay testing** - Validate determinism against production histories\n- **Local development** - Set up Temporal server and pytest\n- **CI\u002FCD integration** - Automated testing pipelines\n- **Coverage strategies** - Cover every workflow decision path\n\n## Testing Philosophy\n\n**Recommended Approach** (Source: docs.temporal.io\u002Fdevelop\u002Fpython\u002Ftesting-suite):\n\n- Write majority as integration tests\n- Use pytest with async fixtures\n- Time-skipping enables fast feedback (month-long workflows → seconds)\n- Mock activities to isolate workflow logic\n- Validate determinism with replay testing\n\n**Three Test Types**:\n\n1. **Unit**: Workflows with time-skipping, activities with ActivityEnvironment\n2. **Integration**: Workers with mocked activities\n3. **End-to-end**: Full Temporal server with real activities (use sparingly)\n\n## Available Resources\n\nThis skill provides detailed guidance through progressive disclosure. Load specific resources based on your testing needs:\n\n### Unit Testing Resources\n\n**File**: `resources\u002Funit-testing.md`\n**When to load**: Testing individual workflows or activities in isolation\n**Contains**:\n\n- WorkflowEnvironment with time-skipping\n- ActivityEnvironment for activity testing\n- Fast execution of long-running workflows\n- Manual time advancement patterns\n- pytest fixtures and patterns\n\n### Integration Testing Resources\n\n**File**: `resources\u002Fintegration-testing.md`\n**When to load**: Testing workflows with mocked external dependencies\n**Contains**:\n\n- Activity mocking strategies\n- Error injection patterns\n- Multi-activity workflow testing\n- Signal and query testing\n- Coverage strategies\n\n### Replay Testing Resources\n\n**File**: `resources\u002Freplay-testing.md`\n**When to load**: Validating determinism or deploying workflow changes\n**Contains**:\n\n- Determinism validation\n- Production history replay\n- CI\u002FCD integration patterns\n- Version compatibility testing\n\n### Local Development Resources\n\n**File**: `resources\u002Flocal-setup.md`\n**When to load**: Setting up development environment\n**Contains**:\n\n- Docker Compose configuration\n- pytest setup and configuration\n- Coverage tool integration\n- Development workflow\n\n## Quick Start Guide\n\n### Basic Workflow Test\n\nVerified against temporalio 1.34 and pytest-asyncio 1.x. Workflow classes must be\ndefined at module level; the SDK rejects a `@workflow.defn` class inside a function.\n\n```python\nimport pytest\nimport pytest_asyncio\nfrom temporalio.testing import WorkflowEnvironment\nfrom temporalio.worker import Worker\n\n# Strict mode (the pytest-asyncio default) needs @pytest_asyncio.fixture for\n# async fixtures; with asyncio_mode = auto, plain @pytest.fixture also works\n@pytest_asyncio.fixture\nasync def workflow_env():\n    env = await WorkflowEnvironment.start_time_skipping()\n    yield env\n    await env.shutdown()\n\n@pytest.mark.asyncio\nasync def test_workflow(workflow_env):\n    async with Worker(\n        workflow_env.client,\n        task_queue=\"test-queue\",\n        workflows=[YourWorkflow],\n        activities=[your_activity],\n    ):\n        result = await workflow_env.client.execute_workflow(\n            YourWorkflow.run,\n            args,\n            id=\"test-wf-id\",\n            task_queue=\"test-queue\",\n        )\n        assert result == expected\n```\n\n### Basic Activity Test\n\n```python\nfrom temporalio.testing import ActivityEnvironment\n\n@pytest.mark.asyncio\nasync def test_activity():\n    env = ActivityEnvironment()\n    result = await env.run(your_activity, \"test-input\")\n    assert result == expected_output\n```\n\n## Coverage Targets\n\nTemporal's docs set no coverage percentage. Pick a `--cov-fail-under` threshold\nfor your team, and aim for:\n\n- **Workflows**: every decision branch exercised\n- **Activities**: success, retryable and non-retryable failure paths\n- **Integration**: Critical paths with mocked activities\n- **Replay**: All workflow versions before deployment\n\n## Key Testing Principles\n\n1. **Time-Skipping** - Month-long workflows test in seconds\n2. **Mock Activities** - Isolate workflow logic from external dependencies\n3. **Replay Testing** - Validate determinism before deployment\n4. **Branch Coverage** - Every path a production workflow can take\n5. **Fast Feedback** - Unit tests run in milliseconds\n\n## How to Use Resources\n\n**Load specific resource when needed**:\n\n- \"Show me unit testing patterns\" → Load `resources\u002Funit-testing.md`\n- \"How do I mock activities?\" → Load `resources\u002Fintegration-testing.md`\n- \"Setup local Temporal server\" → Load `resources\u002Flocal-setup.md`\n- \"Validate determinism\" → Load `resources\u002Freplay-testing.md`\n\n## Additional References\n\n- Python SDK Testing: docs.temporal.io\u002Fdevelop\u002Fpython\u002Ftesting-suite\n- Testing Patterns: github.com\u002Ftemporalio\u002Ftemporal\u002Fblob\u002Fmain\u002Fdocs\u002Fdevelopment\u002Ftesting.md\n- Python Samples: github.com\u002Ftemporalio\u002Fsamples-python\n",{"name":5,"description":7,"last_verified":24},1793059200000,"main","f846d9a97082ff30d613b55a085cef425d822473","plugins\u002Fbackend-development\u002Fskills\u002Ftemporal-python-testing","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle","https:\u002F\u002Fshotcowboystyle.github.io","Building smarter with AI, automation & modern tools. Exploring how far one person can go without a big team using today’s AI.","2026-11-10 04:58:27",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add shotcowboystyle\u002Fag-skills --skill temporal-python-testing",{"tool":39,"command":40},"bunx","bunx skills add shotcowboystyle\u002Fag-skills --skill temporal-python-testing",{"tool":42,"command":43},"pnpm","pnpm dlx skills add shotcowboystyle\u002Fag-skills --skill temporal-python-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fbackend-development\u002Fskills\u002Ftemporal-python-testing\u002FSKILL.md",true,[47,53,57,61],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"resources\u002Fintegration-testing.md","REFERENCE","参考文档",14445,"https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fbackend-development\u002Fskills\u002Ftemporal-python-testing\u002Fresources\u002Fintegration-testing.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"resources\u002Flocal-setup.md",12489,"https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fbackend-development\u002Fskills\u002Ftemporal-python-testing\u002Fresources\u002Flocal-setup.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"resources\u002Freplay-testing.md",13694,"https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fbackend-development\u002Fskills\u002Ftemporal-python-testing\u002Fresources\u002Freplay-testing.md",{"path":62,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":63,"sourceHtmlUrl":64},"resources\u002Funit-testing.md",10024,"https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fbackend-development\u002Fskills\u002Ftemporal-python-testing\u002Fresources\u002Funit-testing.md",[66,72,79,86,93,100],{"skillNo":67,"name":68,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7F1YRY5S5QRJ1V0BJS130QX","no-description","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fno-description\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7F1Y9BV2FJNQJ3NB32JS5CM","good-skill","Fixture skill that satisfies every rule.","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fgood-skill\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7F1XXBQ3NQRXZSS0KAGAR9V","broken-link","Links to a reference file that does not exist.","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fbroken-link\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7F1XBX4R46NR9W0HXQ7XCDX","Bad_Name","Name violates the kebab-case rule and does not match the directory.","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fbad-name\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7F1WNAF8WNEQ7S5HKT5VK0D","skill-authoring","Write, review, and validate portable agent skills in SKILL.md format. Use when creating a new skill, editing an existing one, or asked whether a skill follows the Agent Skills spec.","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Fskills\u002Fskill-authoring\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M7F1W30TC0XFNSF7YBRGETK2","weigh-bags","Record scale readings for each bag — empty (tare), outbound, current, final — and reconcile them against the itemised inventory to find unaccounted weight. Use when the user gives a bag weight, says how heavy something is, weighs their luggage, or asks how close to the limit they are. Appends to bags.yaml and runs scripts\u002Freconcile.py.","https:\u002F\u002Fgithub.com\u002Fshotcowboystyle\u002Fag-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftravel-packing-assistant\u002Fskills\u002Fweigh-bags\u002FSKILL.md",[],[]]