Airflow Summit 2025 is coming October 07-09. Register now for early bird ticket!

tests.system.openlineage.expected_events

Attributes

AIRFLOW_VERSION

Functions

get_expected_event_file_path(dag_id)

Retrieve the file path to the OpenLineage expected events JSON file for a given DAG ID,

Package Contents

tests.system.openlineage.expected_events.AIRFLOW_VERSION[source]
tests.system.openlineage.expected_events.get_expected_event_file_path(dag_id)[source]

Retrieve the file path to the OpenLineage expected events JSON file for a given DAG ID, taking into account the Airflow version currently in use.

Since expected event outputs may differ between Airflow versions, this function attempts to locate the most specific expected event file available for the running Airflow version, following this precedence order:

  1. A file named {dag_id}__af{major_version}_{minor_version}.json

    (e.g., example_dag__af2_10.json for Airflow 2.10.x)

  2. A file named {dag_id}__af{major_version}.json

    (e.g., example_dag__af3.json for any Airflow 3.x version)

  3. A generic file named {dag_id}.json without version suffix

    (e.g., example_dag.json for any Airflow version)

The function returns the path to the first existing file found in this order. We expect all the files to follow the naming convention described above.

If none of the expected files exist, it raises a ValueError indicating that no matching expected event file could be found.

Args:

dag_id: The identifier of the DAG whose expected event file is to be retrieved.

Returns:

The file path to the appropriate expected events JSON file.

Raises:

ValueError: If no expected event files matching the DAG ID and Airflow version are found.

Was this entry helpful?