Python workflow testing examples?

Hi! :wave: I’m looking to understand how testing of workflows defined in the Python SDK can be accomplished. Testing activities seems simple enough, i.e., it’s really no different from testing any other function. I didn’t see any obvious guidance in the sdk-python repo, nor in GitHub - temporalio/samples-python: Samples for working with the Temporal Python SDK .

Can anyone provide guidance and/or examples on testing workflows defined in Python?

Hi @pleases.borderland

Here is a more in detail example of a workflow using python: GitHub - temporalio/sdk-python: Temporal Python SDK. Further down there is more information going over how to run a workflow, invoking activities, invoking child workflows, timers, conditions, asyncio and cancellation, workflow utilities, exceptions, etc…

Let me know if this is resourceful.

Best Regards,
Jordan

Thanks for the reply, @jreynolds23 !

The link you shared definitely provides guidance on running workflows, but I can’t find anything describing writing unit/integration tests for workflows. Do you happen to know of code samples of tests covering workflow code?

Thanks again!

The test framework to make unit testing of activities and workflows in Python is under active development. I hope to complete it soon. I will update Test framework · Issue #81 · temporalio/sdk-python · GitHub when the PR is available.

In the meantime, some users write integration tests using a real Temporal server (e.g. Temporalite). In fact, the Python SDK tests are written this way.

2 Likes