dheerajturaga commented on code in PR #61616:
URL: https://github.com/apache/airflow/pull/61616#discussion_r2778391841
##########
providers/edge3/tests/unit/edge3/cli/test_worker.py:
##########
@@ -321,9 +322,9 @@ async def test_push_logs_in_chunks(self, mock_logs_push,
worker_with_job: EdgeWo
@pytest.mark.asyncio
async def test_check_running_jobs_log_push_increment(self, mock_logs_push,
worker_with_job: EdgeWorker):
job = EdgeWorker.jobs[0]
- job.logfile.write_text("hello ")
- job.logsize = job.logfile.stat().st_size
- job.logfile.write_text("hello world")
+ await anyio.Path(job.logfile).write_text("hello ")
+ job.logsize = (await anyio.Path(job.logfile).stat()).st_size
+ await anyio.Path(job.logfile).write_text("hello world")
Review Comment:
the test creates anyio.Path(job.logfile) three times in
test_check_running_jobs_log_push_increment instead of caching it like the
production code does.
```suggestion
aio_logfile = anyio.Path(job.logfile)
await aio_logfile.write_text("hello ")
job.logsize = (await aio_logfile.stat()).st_size
await aio_logfile.write_text("hello world")
```
--
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]