Skip to content

Commit 53ba24d

Browse files
committed
resolve linting issues
1 parent c90b70e commit 53ba24d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

tests/test_gh_file_viewer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
import json
55
import os
6+
import tempfile
67
import zipfile
78
from io import BytesIO
9+
from pathlib import Path
810
from unittest.mock import AsyncMock, MagicMock, patch
911

1012
import httpx
@@ -309,8 +311,7 @@ async def test_search_repo_finds_matches(self):
309311

310312
async def fake_fetch_source_zip(owner, repo, tmp_dir):
311313
os.makedirs(f"{tmp_dir}/{owner}", exist_ok=True)
312-
with open(f"{tmp_dir}/{owner}/{repo}.zip", "wb") as f:
313-
f.write(zip_bytes)
314+
Path(f"{tmp_dir}/{owner}/{repo}.zip").write_bytes(zip_bytes)
314315
return "source code fetched"
315316

316317
with patch.object(gfv_mod, "_fetch_source_zip", side_effect=fake_fetch_source_zip):
@@ -329,8 +330,7 @@ async def test_search_repo_no_matches(self):
329330

330331
async def fake_fetch_source_zip(owner, repo, tmp_dir):
331332
os.makedirs(f"{tmp_dir}/{owner}", exist_ok=True)
332-
with open(f"{tmp_dir}/{owner}/{repo}.zip", "wb") as f:
333-
f.write(zip_bytes)
333+
Path(f"{tmp_dir}/{owner}/{repo}.zip").write_bytes(zip_bytes)
334334
return "source code fetched"
335335

336336
with patch.object(gfv_mod, "_fetch_source_zip", side_effect=fake_fetch_source_zip):
@@ -368,7 +368,6 @@ def test_search_zipfile(self):
368368
"main.py": "import os\nimport sys\nprint('hello')\n",
369369
"utils.py": "def helper(): pass\n",
370370
})
371-
import tempfile
372371
with tempfile.NamedTemporaryFile(suffix=".zip", delete=False) as f:
373372
f.write(zip_bytes)
374373
f.flush()

0 commit comments

Comments
 (0)