temporal-python-testing
Test Temporal workflows with pytest and mocks
Temporal workflow tests are often slow or flaky. This skill provides fast, deterministic testing patterns using time-skipping, activity mocking, and replay validation for reliable CI/CD pipelines.
Download the skill ZIP
Upload in Claude
Go to Settings โ Capabilities โ Skills โ Upload skill
Toggle on and start using
Test it
Using "temporal-python-testing". Create a test plan for Temporal workflows with unit, integration, and replay coverage.
Expected outcome:
- Use WorkflowEnvironment with time skipping for fast unit workflow tests
- Mock external dependencies in integration tests and verify error handling paths
- Export production histories and replay against new code before deployment
Using "temporal-python-testing". How do I test a workflow that has retry logic and multiple activities?
Expected outcome:
- Create a test with mocked activities to isolate workflow logic
- Use ActivityEnvironment to test activity-specific error handling
- Verify retry behavior by counting activity invocations
- Test both success and failure paths with assertions
Using "temporal-python-testing". What are common mistakes when testing Temporal workflows?
Expected outcome:
- Calling real external APIs instead of mocking them
- Using random() or datetime.now() which breaks replay determinism
- Skipping replay tests before deploying workflow changes
- Not using time-skipping for long-running workflow tests
Security Audit
SafeEducational documentation for Temporal workflow testing. Static scanner false positives: markdown code block backticks flagged as shell execution, legitimate docs URLs as hardcoded URLs, and test code patterns as cryptographic/C2 indicators. Previous Claude audit (skill-report.json) confirmed safe with no risk factors. All 149 findings are false positives from documentation patterns.
Risk Factors
โ๏ธ External commands (125)
๐ Network access (6)
Quality Score
What You Can Build
Add fast unit tests
Create quick workflow and activity tests with time skipping that run in milliseconds instead of hours.
Validate integration flows
Mock external services and verify complex workflow orchestration paths with error injection.
Run replay checks
Confirm workflow determinism before deployment and validate version compatibility.
Try These Prompts
Show me a minimal pytest setup to test a workflow with time skipping and a simple activity. Include fixtures and assertions.
Provide an integration test example that mocks activities and verifies workflow branching logic based on activity results.
Explain how to replay workflow histories from production and detect non-deterministic changes that could break running workflows.
Outline a complete CI plan with pytest markers, coverage thresholds, and automated replay tests for safe deployments.
Best Practices
- Use time skipping for all workflow unit tests to run month-long workflows in seconds
- Mock external dependencies in integration tests to isolate workflow logic
- Run replay tests before deploying any workflow changes to ensure determinism
Avoid
- Calling real external APIs inside workflow tests instead of mocking
- Using random() or datetime.now() in workflow code without Temporal helpers
- Skipping replay tests after significant workflow refactors or logic changes
Frequently Asked Questions
What Python versions are supported?
Are there limits on test size?
Can I integrate this with existing pytest setups?
Does this skill access my data or credentials?
What if tests fail due to nondeterminism?
How does this compare to end-to-end tests?
Developer Details
File structure