jason810496 commented on code in PR #70805:
URL: https://github.com/apache/airflow/pull/70805#discussion_r3702545098
##########
task-sdk/tests/task_sdk/coordinators/executable/test_coordinator.py:
##########
@@ -370,13 +370,42 @@ def test_executables_root_accepts_list(self, tmp_path):
coordinator = ExecutableCoordinator(executables_root=[str(tmp_path),
other])
assert coordinator.executables_root == [tmp_path, other]
- def test_executables_root_required(self):
- with pytest.raises(TypeError, match="executables_root"):
- ExecutableCoordinator()
-
- def test_executables_root_must_be_non_empty(self):
- with pytest.raises(ValueError, match="executables_root"):
- ExecutableCoordinator(executables_root=None)
+ def test_executables_root_optional_defaults_to_empty(self):
+ # Neither an explicit root nor dag_bundle_name: co-located mode, valid.
+ coordinator = ExecutableCoordinator()
+ assert coordinator.executables_root == []
+ assert coordinator.dag_bundle_name is None
+
+ def test_none_executables_root_normalized_to_empty(self):
+ coordinator = ExecutableCoordinator(executables_root=None)
+ assert coordinator.executables_root == []
+
+ def test_root_and_dag_bundle_name_are_mutually_exclusive(self, tmp_path):
+ with pytest.raises(ValueError, match="at most one of
'executables_root' or 'dag_bundle_name'"):
+ ExecutableCoordinator(executables_root=[tmp_path],
dag_bundle_name="artifacts")
+
+ @patch("airflow.dag_processing.bundles.manager.DagBundlesManager")
+ def test_unconfigured_dag_bundle_name_raises(self, mock_manager):
+ mock_manager.is_bundle_configured.return_value = False
+ with pytest.raises(ValueError, match="unconfigured Dag bundle
'ghost'"):
+ ExecutableCoordinator(dag_bundle_name="ghost")
+
+ @patch("airflow.dag_processing.bundles.manager.DagBundlesManager")
+ def test_configured_dag_bundle_name_accepted(self, mock_manager):
+ mock_manager.is_bundle_configured.return_value = True
+ coordinator = ExecutableCoordinator(dag_bundle_name="artifacts")
+ assert coordinator.dag_bundle_name == "artifacts"
+ mock_manager.is_bundle_configured.assert_called_once_with("artifacts")
+
+ def test_build_command_scans_given_roots(self, tmp_path):
Review Comment:
I added additional tests to cover this scenarios, thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]