Skip to content

Commit 3b41598

Browse files
committed
-
1 parent 3c8d235 commit 3b41598

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

plugins/yjs/tests/test_ydocs.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import shutil
2-
import tempfile
32
from inspect import isawaitable
43
from pathlib import Path
54

@@ -35,8 +34,13 @@ async def assert_with_timeout(func, timeout=100):
3534

3635
@pytest.mark.anyio
3736
async def test_ydrive():
38-
with tempfile.TemporaryDirectory() as tmp_dir:
39-
tmp_dir = Path(tmp_dir)
37+
tmp_dirname = "tmpdir_test_ydrive"
38+
try:
39+
tmp_dir = Path(tmp_dirname)
40+
if tmp_dir.exists():
41+
shutil.rmtree(tmp_dirname)
42+
tmp_dir.mkdir()
43+
4044
(tmp_dir / "file0").write_text(" " * 1)
4145
(tmp_dir / "file1").write_text(" " * 2)
4246
(tmp_dir / "dir0").mkdir()
@@ -135,3 +139,6 @@ async def _(): return "file5" not in await ydrive.ls("dir1/dir2")
135139
await assert_with_timeout(_)
136140
async def _(): return "file5" in await ydrive.ls("dir1")
137141
await assert_with_timeout(_)
142+
143+
finally:
144+
shutil.rmtree(tmp_dirname)

0 commit comments

Comments
 (0)