jedcunningham commented on code in PR #45779:
URL: https://github.com/apache/airflow/pull/45779#discussion_r1971896046
##########
tests_common/pytest_plugin.py:
##########
@@ -1423,6 +1423,31 @@ def _get(dag_id: str):
dagbag = DagBag(dag_folder=dag_file, include_examples=False)
dag = dagbag.get_dag(dag_id)
+
+ if dagbag.import_errors:
+ session = settings.Session()
+ from airflow.models.errors import ParseImportError
+ from airflow.utils import timezone
+
+ # # Delete the previous import errors
+ # session.query(ParseImportError).filter(
+ # ParseImportError.bundle_name == "testing",
ParseImportError.filename == str(dag_file)
+ # ).delete()
+ # session.commit()
+
Review Comment:
```suggestion
```
##########
tests/cli/commands/remote_commands/test_dag_command.py:
##########
@@ -76,9 +81,18 @@ def teardown_class(cls) -> None:
clear_db_runs()
clear_db_dags()
- def setup_method(self):
+ def setup_method(self, method):
+ print("running setup methods")
clear_db_runs() # clean-up all dag run before start each test
+ if method.__name__ == "test_cli_list_dags_prints_import_errors":
+ clear_db_import_errors()
+
+ def teardown_method(self, method):
+ # Clean-up all import errors after the test
+ if method.__name__ == "test_cli_list_dags_prints_import_errors":
+ clear_db_import_errors()
Review Comment:
```suggestion
def setup_method(self):
clear_db_runs()
clear_db_import_errors()
def teardown_method(self):
clear_db_import_errors()
```
Just keep it simple and clear for everything here. Less likely for
copy/paste down the road to miss the cleanup.
--
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]