Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Jan 11, 2024
1 parent 3c8d235 commit 3b41598
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugins/yjs/tests/test_ydocs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import shutil
import tempfile
from inspect import isawaitable
from pathlib import Path

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

@pytest.mark.anyio
async def test_ydrive():
with tempfile.TemporaryDirectory() as tmp_dir:
tmp_dir = Path(tmp_dir)
tmp_dirname = "tmpdir_test_ydrive"
try:
tmp_dir = Path(tmp_dirname)
if tmp_dir.exists():
shutil.rmtree(tmp_dirname)
tmp_dir.mkdir()

(tmp_dir / "file0").write_text(" " * 1)
(tmp_dir / "file1").write_text(" " * 2)
(tmp_dir / "dir0").mkdir()
Expand Down Expand Up @@ -135,3 +139,6 @@ async def _(): return "file5" not in await ydrive.ls("dir1/dir2")
await assert_with_timeout(_)
async def _(): return "file5" in await ydrive.ls("dir1")
await assert_with_timeout(_)

finally:
shutil.rmtree(tmp_dirname)

0 comments on commit 3b41598

Please sign in to comment.