diff --git a/airflow/dag_processing/bundles/base.py b/airflow/dag_processing/bundles/base.py index 34f3dd65c8b4e..05a9fd500caa3 100644 --- a/airflow/dag_processing/bundles/base.py +++ b/airflow/dag_processing/bundles/base.py @@ -70,7 +70,7 @@ def path(self) -> Path: """ @abstractmethod - def get_current_version(self) -> str: + def get_current_version(self) -> str | None: """ Retrieve a string that represents the version of the DAG bundle. diff --git a/airflow/dag_processing/bundles/local.py b/airflow/dag_processing/bundles/local.py index dcbac96911159..94369934184ad 100644 --- a/airflow/dag_processing/bundles/local.py +++ b/airflow/dag_processing/bundles/local.py @@ -20,7 +20,6 @@ from pathlib import Path from airflow.dag_processing.bundles.base import BaseDagBundle -from airflow.exceptions import AirflowException class LocalDagBundle(BaseDagBundle): @@ -36,8 +35,8 @@ def __init__(self, *, local_folder: str, **kwargs) -> None: super().__init__(**kwargs) self._path = Path(local_folder) - def get_current_version(self) -> str: - raise AirflowException("Not versioned!") + def get_current_version(self) -> None: + return None def refresh(self) -> None: """Nothing to refresh - it's just a local directory.""" diff --git a/tests/dag_processing/test_dag_bundles.py b/tests/dag_processing/test_dag_bundles.py index 1a911a52eff0b..d3746c01a63ee 100644 --- a/tests/dag_processing/test_dag_bundles.py +++ b/tests/dag_processing/test_dag_bundles.py @@ -47,13 +47,12 @@ def test_path(self): bundle = LocalDagBundle(name="test", local_folder="/hello") assert bundle.path == Path("/hello") - def test_does_not_support_versioning(self): + def test_none_for_version(self): assert LocalDagBundle.supports_versioning is False bundle = LocalDagBundle(name="test", local_folder="/hello") - with pytest.raises(AirflowException): - bundle.get_current_version() + assert bundle.get_current_version() is None @pytest.fixture