diff --git a/pyproject.toml b/pyproject.toml index ee777d9..3a5c9eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,7 @@ target-version = "py310" exclude = ["*.md"] # Markdown snippets: blacken-docs (CI), at 100 [tool.ruff.lint] -select = ["E", "F", "I", "UP", "B"] +select = ["E", "F", "I", "UP", "B", "ASYNC"] [tool.ty.terminal] error-on-warning = true diff --git a/tests/test_http.py b/tests/test_http.py index 0167dea..10f79b4 100644 --- a/tests/test_http.py +++ b/tests/test_http.py @@ -303,7 +303,7 @@ def readinto(self, buffer): async def go(): async with RawServer(ok) as server, HttpClient() as client: - with open(path, "rb") as f: + with open(path, "rb") as f: # noqa: ASYNC230 — testing multipart with a sync file object await client.post(f"{server.url}/v1/upload", form=multipart(None, {"file": f})) return server.received[0] @@ -365,7 +365,7 @@ async def send_once_then_retry(): # (IOBasePayload._close); wait for that close so the second send never races # ahead of the first send's cleanup deadline = asyncio.get_running_loop().time() + 5.0 - while not f.closed and asyncio.get_running_loop().time() < deadline: + while not f.closed and asyncio.get_running_loop().time() < deadline: # noqa: ASYNC110 await asyncio.sleep(0.005) assert f.closed, "first send did not close the open file" await client.post(f"{server.url}/v1/upload", form=multipart(None, {"file": f})) diff --git a/tests/test_sinks.py b/tests/test_sinks.py index 73cf08e..40c6d8e 100644 --- a/tests/test_sinks.py +++ b/tests/test_sinks.py @@ -1999,7 +1999,7 @@ async def results(): yield Done("r0", {}, {"v": 0}, None, {}) yield Done("r1", {}, {"v": 1}, None, {}) # size flush writes part 1 deadline = time.monotonic() + 2.0 - while len(list(tmp_path.glob("part-*.parquet"))) < 1 and time.monotonic() < deadline: + while len(list(tmp_path.glob("part-*.parquet"))) < 1 and time.monotonic() < deadline: # noqa: ASYNC110 await asyncio.sleep(0.02) assert len(list(tmp_path.glob("part-*.parquet"))) == 1 await asyncio.sleep(0.6) # 0.6 s since r0 @@ -2007,7 +2007,7 @@ async def results(): await asyncio.sleep(0.5) # ~1.1 s since r0 (> 1.0 s), but only ~0.5 s since r2 events["parts_before_interval"] = len(list(tmp_path.glob("part-*.parquet"))) deadline = time.monotonic() + 3.0 - while len(list(tmp_path.glob("part-*.parquet"))) < 2 and time.monotonic() < deadline: + while len(list(tmp_path.glob("part-*.parquet"))) < 2 and time.monotonic() < deadline: # noqa: ASYNC110 await asyncio.sleep(0.02) events["parts_after_interval"] = len(list(tmp_path.glob("part-*.parquet")))