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/09/06 08:59:27 UTC

[GitHub] [airflow] kokorin commented on a diff in pull request #26105: Fix: git clone on Windows

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()
 
 
+@pytest.fixture
+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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org