Skip to main content

prefect.testing.fixtures

Functions

add_prefect_loggers_to_caplog

is_port_in_use

hosted_api_server

Runs an instance of the Prefect API server in a subprocess instead of the using the ephemeral application. Uses the same database as the rest of the tests.

use_hosted_api_server

Sets PREFECT_API_URL to the test session’s hosted API endpoint.

disable_hosted_api_server

Disables the hosted API server by setting PREFECT_API_URL to None.

enable_ephemeral_server

Enables the ephemeral server by setting PREFECT_SERVER_ALLOW_EPHEMERAL_MODE to True.

mock_anyio_sleep

Mock sleep used to not actually sleep but to set the current time to now + sleep delay seconds while still yielding to other tasks in the event loop. Provides “assert_sleeps_for” context manager which asserts a sleep time occurred within the context while using the actual runtime of the context as a tolerance.

recorder

puppeteer

events_server

events_api_url

events_cloud_api_url

mock_should_emit_events

asserting_events_worker

asserting_and_emitting_events_worker

events_pipeline

emitting_events_pipeline

reset_worker_events

Classes

Recorder

Puppeteer