temporal-python-testing
Master Temporal Python Workflow Testing
Também disponível em: wshobson
Testing Temporal workflows is complex due to time-dependent operations and distributed execution. This skill provides proven pytest patterns with time-skipping, activity mocking, and replay testing to achieve reliable test coverage.
Baixar o ZIP da skill
Upload no Claude
Vá em Configurações → Capacidades → Skills → Upload skill
Ative e comece a usar
Testar
A utilizar "temporal-python-testing". Test a workflow with a 7-day approval timeout
Resultado esperado:
- Workflow test completes in 50ms using time-skipping mode
- All approval path branches tested with parameterized inputs
- Coverage report shows 92% workflow logic coverage
A utilizar "temporal-python-testing". Replay test against 50 production histories
Resultado esperado:
- 48 workflows replayed successfully - deterministic
- 2 workflows failed - non-deterministic random number usage detected
- Recommendation: Replace random module with workflow.random()
Auditoria de Segurança
Baixo RiscoStatic analyzer detected 140 patterns flagged as security concerns, but all are false positives from Markdown documentation containing Python code examples. The 'Ruby/shell backtick execution' patterns are Python code fences in markdown. URLs are localhost development references. Network, filesystem, and cryptographic findings are documentation examples, not executable code. Safe for publication as educational content.
Problemas de Baixo Risco (1)
Fatores de risco
⚙️ Comandos externos (16)
Pontuação de qualidade
O Que Você Pode Construir
Backend Developer Testing Workflows
A Python developer needs to test Temporal workflows that include month-long sleep durations. Use this skill to implement time-skipping tests that complete in milliseconds, achieving fast feedback during development.
QA Engineer Validating Determinism
A QA engineer must verify workflow changes do not break existing executions. Use this skill to set up replay testing that validates determinism against production workflow histories before deployment.
DevOps Engineer Setting Up CI/CD
A DevOps engineer needs automated testing for Temporal workflows in CI/CD pipelines. Use this skill to integrate pytest with coverage tracking and automated history export for regression testing.
Tente Estes Prompts
Help me write a pytest test for a Temporal workflow that includes a 30-day sleep. Show me how to use WorkflowEnvironment with time-skipping so the test completes instantly.
I have a workflow that calls payment and inventory APIs through activities. Show me how to mock these activities in integration tests to test the workflow orchestration logic without calling real external services.
I modified my workflow code and need to verify it is backward-compatible with running workflows. Show me how to export production workflow histories and replay them with the new code to validate determinism.
Set up a GitHub Actions workflow that runs pytest tests for Temporal workflows, including Docker Compose for the Temporal server, coverage reporting with 80% threshold, and automated history export for replay testing.
Melhores Práticas
- Use time-skipping WorkflowEnvironment for all unit tests to achieve fast feedback - month-long workflows should test in milliseconds
- Mock all external dependencies in integration tests - never call real APIs during test execution to ensure reliability and speed
- Run replay tests against production histories before every deployment - this validates determinism and prevents breaking running workflows
Evitar
- Using datetime.now() or random module directly in workflows - these break determinism and cause replay failures
- Writing end-to-end tests with real Temporal server for every test - this is slow and brittle; prefer time-skipping unit tests
- Skipping replay testing before deployment - workflow code changes may break existing executions without proper validation
Perguntas Frequentes
Why do my replay tests fail after refactoring workflow code?
How do I test workflows with long sleep durations without waiting?
Should I test activities with ActivityEnvironment or in a Worker?
How often should I export production workflow histories for replay testing?
What coverage target should I aim for with Temporal workflows?
Can I use this skill with Claude, Codex, or Claude Code?
Detalhes do Desenvolvedor
Autor
sickn33Licença
MIT
Repositório
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/temporal-python-testingReferência
main
Estrutura de arquivos