Skip to main content

prefect.testing.utilities

Internal utilities for tests.

Functions

exceptions_equal

Exceptions cannot be compared by ==. They can be compared using is but this will fail if the exception is serialized/deserialized so this utility does its best to assert equality using the type and args used to initialize the exception

kubernetes_environments_equal

assert_does_not_warn

Converts warnings to errors within this context to assert warnings are not raised, except for those specified in ignore_warnings. Parameters:
  • ignore_warnings: List of warning types to ignore. Example: [DeprecationWarning, UserWarning]

prefect_test_harness

Temporarily run flows against a local SQLite database for testing. Args:
  • server_startup_timeout: The maximum time to wait for the server to start. Defaults to 30 seconds. If set to None, the value of PREFECT_SERVER_EPHEMERAL_STARTUP_TIMEOUT_SECONDS will be used.
Examples:

get_most_recent_flow_run

assert_blocks_equal

assert_uses_result_serializer

assert_uses_result_storage

a_test_step

b_test_step