kokorin commented on code in PR #26105:
URL: https://github.com/apache/airflow/pull/26105#discussion_r963447265


##########
tests/www/views/test_views_log.py:
##########
@@ -163,6 +169,22 @@ def tis(dags, session):
     clear_db_runs()
 
 
[email protected]
+def create_expected_log_file(log_path, tis):
+    ti, _ = tis
+    handler = FileTaskHandler(log_path)
+
+    def create_expected_log_file(try_number):
+        ti.try_number = try_number - 1
+        handler.set_context(ti)
+        handler.emit(logging.makeLogRecord({"msg": "Log for testing."}))
+        handler.flush()
+
+    yield create_expected_log_file
+    # delete logs to minimize tests interference
+    shutil.rmtree(log_path)

Review Comment:
   @uranusjr pytest cleans directories after exiting defined scope. `log_path` 
fixture requires `module` scope to be used by `log_app` fixture (which also has 
`module` scope). But `log_path` should be cleared after each test, because 
almost all tests reference to the same Dag.



-- 
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]

Reply via email to