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 2022/03/08 19:27:21 UTC
[GitHub] [airflow] ephraimbuddy commented on a change in pull request #21991: Show import error for 'airflow dags list' CLI command
ephraimbuddy commented on a change in pull request #21991:
URL: https://github.com/apache/airflow/pull/21991#discussion_r821996878
##########
File path: tests/cli/commands/test_dag_command.py
##########
@@ -407,6 +407,15 @@ def test_cli_list_dags(self):
assert "airflow/example_dags/example_complex.py" in out
assert "- dag_id:" in out
+ @conf_vars({('core', 'load_examples'): 'false'})
+ def test_cli_list_dags_prints_import_errors(self):
+ dag_path = os.path.join(TEST_DAGS_FOLDER, 'test_invalid_cron.py')
+ args = self.parser.parse_args(['dags', 'list', '--output', 'yaml', '--subdir', dag_path])
+ with contextlib.redirect_stderr(io.StringIO()) as temp_stdout:
+ dag_command.dag_list_dags(args)
+ out = temp_stdout.getvalue()
Review comment:
```suggestion
with contextlib.redirect_stderr(io.StringIO()) as temp_stderr:
dag_command.dag_list_dags(args)
out = temp_stderr.getvalue()
```
--
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