You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/11 16:38:49 UTC
[GitHub] [airflow] ephraimbuddy commented on a change in pull request #17207: Fix external_executor_id not being set for manually run jobs.
ephraimbuddy commented on a change in pull request #17207:
URL: https://github.com/apache/airflow/pull/17207#discussion_r706633517
##########
File path: tests/executors/test_celery_executor.py
##########
@@ -288,6 +291,9 @@ def test_command_validation(self, command, expected_exception):
with mock.patch(
'airflow.executors.celery_executor._execute_in_subprocess'
) as mock_subproc, mock.patch('airflow.executors.celery_executor._execute_in_fork') as mock_fork:
+ test_app = MagicMock()
+ test_app.current_task.request.id.side_effect = "abcdef-124215-abcdef"
+ mock.patch('airflow.executors.celery_executor.app', test_app)
Review comment:
I think we can approach this like this:
```python
with mock.patch(
'airflow.executors.celery_executor._execute_in_subprocess'
) as mock_subproc, mock.patch('airflow.executors.celery_executor._execute_in_fork') as mock_fork,
mock.patch('airflow.executors.celery_executor.app') as test_app:
test_app.current_task.request.id.side_effect = "abcdef-124215-abcdef"
```
WDYT?
##########
File path: tests/executors/test_celery_executor.py
##########
@@ -71,6 +73,7 @@ def _prepare_app(broker_url=None, execute=None):
test_config = dict(celery_executor.celery_configuration)
test_config.update({'broker_url': broker_url})
test_app = Celery(broker_url, config_source=test_config)
+ mock.patch(test_app)
Review comment:
```suggestion
```
Do we need it here?
##########
File path: tests/cli/commands/test_task_command.py
##########
@@ -106,7 +106,41 @@ def test_test_with_existing_dag_run(self):
task_command.task_test(args)
# Check that prints, and log messages, are shown
- assert f"Marking task as SUCCESS. dag_id={self.dag_id}, task_id={task_id}" in stdout.getvalue()
+ assert f"Marking task as SUCCESS. dag_id={dag_id}, task_id={task_id}" in stdout.getvalue()
Review comment:
```suggestion
assert f"Marking task as SUCCESS. dag_id={self.dag_id}, task_id={task_id}" in stdout.getvalue()
```
Any reason for the change?
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org