anvil.testing.server Module

This module contains helpers for testing server code that uses anvil.server.

Functions

wait_for_background_tasks_to_finish([timeout=5])

If the app’s code has launched background tasks in this test run, wait for them to finish.

Raises anvil.server.TimeoutError if any are still running after timeout seconds.

with capture_emails() as emails:
    place_order(user, items)  # Sends a receipt from a background task
    wait_for_background_tasks_to_finish()

[receipt] = emails

  • timeout - How many seconds to wait before timing out.



Do you still have questions?

Our Community Forum is full of helpful information and Anvil experts.

anvil.testing.server