ashb commented on code in PR #44898:
URL: https://github.com/apache/airflow/pull/44898#discussion_r1883765817
##########
tests/dag_processing/test_processor.py:
##########
@@ -246,183 +243,6 @@ def test_process_file_should_failure_callback(self,
monkeypatch, tmp_path, get_t
msg = " ".join([str(k) for k in ti.key.primary]) + " fired callback"
assert msg in callback_file.read_text()
- @conf_vars({("core", "dagbag_import_error_tracebacks"): "False"})
- def
test_add_unparseable_file_before_sched_start_creates_import_error(self,
tmp_path):
- unparseable_filename = tmp_path.joinpath(TEMP_DAG_FILENAME).as_posix()
- with open(unparseable_filename, "w") as unparseable_file:
- unparseable_file.writelines(UNPARSEABLE_DAG_FILE_CONTENTS)
-
- with create_session() as session:
- self._process_file(unparseable_filename, dag_directory=tmp_path,
session=session)
- import_errors = session.query(ParseImportError).all()
-
- assert len(import_errors) == 1
- import_error = import_errors[0]
- assert import_error.filename == unparseable_filename
- assert import_error.stacktrace == f"invalid syntax
({TEMP_DAG_FILENAME}, line 1)"
- session.rollback()
-
- @conf_vars({("core", "dagbag_import_error_tracebacks"): "False"})
- def test_add_unparseable_zip_file_creates_import_error(self, tmp_path):
- zip_filename = (tmp_path / "test_zip.zip").as_posix()
- invalid_dag_filename = os.path.join(zip_filename, TEMP_DAG_FILENAME)
- with ZipFile(zip_filename, "w") as zip_file:
- zip_file.writestr(TEMP_DAG_FILENAME, UNPARSEABLE_DAG_FILE_CONTENTS)
-
- with create_session() as session:
- self._process_file(zip_filename, dag_directory=tmp_path,
session=session)
- import_errors = session.query(ParseImportError).all()
-
- assert len(import_errors) == 1
- import_error = import_errors[0]
- assert import_error.filename == invalid_dag_filename
- assert import_error.stacktrace == f"invalid syntax
({TEMP_DAG_FILENAME}, line 1)"
- session.rollback()
Review Comment:
It could be worth keeping these to ensure that `dagbag.import_errors` is
populated. Thoughts?
--
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]