This is an automated email from the ASF dual-hosted git repository.

husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7b2c35cee3 Enable `ASYNC` ruff rules (#38300)
7b2c35cee3 is described below

commit 7b2c35cee3b22d513baf73eba2b2540dc924d1ff
Author: Andrey Anshin <[email protected]>
AuthorDate: Wed Mar 20 02:04:48 2024 +0400

    Enable `ASYNC` ruff rules (#38300)
---
 pyproject.toml                   | 2 ++
 tests/jobs/test_triggerer_job.py | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 46a9d81e14..76d582e6b3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -343,6 +343,7 @@ devel-static-checks = [
     "yamllint>=1.33.0",
 ]
 devel-tests = [
+    "aiofiles>=23.2.0",
     "aioresponses>=0.7.6",
     "backports.zoneinfo>=0.2.1;python_version<'3.9'",
     "beautifulsoup4>=4.7.1",
@@ -1317,6 +1318,7 @@ extend-select = [
     # Enable entire ruff rule section
     "I", # Missing required import (auto-fixable)
     "UP", # Pyupgrade
+    "ASYNC", # subset of flake8-async rules
     "ISC",  # Checks for implicit literal string concatenation (auto-fixable)
     "TCH", # Rules around TYPE_CHECKING blocks
     "G", # flake8-logging-format rules
diff --git a/tests/jobs/test_triggerer_job.py b/tests/jobs/test_triggerer_job.py
index 7ce4f94590..9279c97d53 100644
--- a/tests/jobs/test_triggerer_job.py
+++ b/tests/jobs/test_triggerer_job.py
@@ -24,6 +24,7 @@ import time
 from threading import Thread
 from unittest.mock import MagicMock, patch
 
+import aiofiles
 import pendulum
 import pytest
 
@@ -58,8 +59,8 @@ class TimeDeltaTrigger_(TimeDeltaTrigger):
         self.delta = delta
 
     async def run(self):
-        with open(self.filename, "a") as f:
-            f.write("hi\n")
+        async with aiofiles.open(self.filename, mode="a") as f:
+            await f.write("hi\n")
         async for event in super().run():
             yield event
 

Reply via email to