From 64d96354e15cfd12ededd335e23a59a23cd25382 Mon Sep 17 00:00:00 2001 From: Ilyas Shaikh Date: Wed, 2 Oct 2024 19:08:32 +0530 Subject: [PATCH] Added ruff formatting --- tests/test_util.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_util.py b/tests/test_util.py index e80f04128..2d99462cb 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -32,12 +32,13 @@ async def test_ensure_directory_absent(tmp_path: pathlib.Path): await ensure_absent(path) assert not await aiofiles.os.path.exists(path) + @pytest.mark.asyncio async def test_ensure_file_absent_when_open_for_reading(tmp_path: pathlib.Path): path = tmp_path / "test_file" async with aiofiles.open(path, "w") as test_file: await test_file.write("foobar") - + # Open the file for reading async with aiofiles.open(path, "r"): pass # Simply open and close the file @@ -45,7 +46,8 @@ async def test_ensure_file_absent_when_open_for_reading(tmp_path: pathlib.Path): # Ensure the file is removed await ensure_absent(path) assert not await aiofiles.os.path.exists(path) - + + @pytest.mark.asyncio async def test_ensure_non_empty_directory_absent(tmp_path: pathlib.Path): # Create a directory @@ -63,7 +65,8 @@ async def test_ensure_non_empty_directory_absent(tmp_path: pathlib.Path): # The directory should still exist since it was not removed assert await aiofiles.os.path.exists(path) - + + @pytest.mark.asyncio async def test_ensure_invalid_path(tmp_path: pathlib.Path): # Create an invalid path (e.g., a socket or a broken symlink) @@ -92,7 +95,8 @@ async def test_ensure_absent_called_on_symlink(tmp_path: pathlib.Path): # Original file should still exist assert await aiofiles.os.path.exists(path) - + + @pytest.mark.asyncio async def test_ensure_absent_removes_nested_empty_directory(tmp_path: pathlib.Path): # Create a nested directory structure @@ -105,4 +109,3 @@ async def test_ensure_absent_removes_nested_empty_directory(tmp_path: pathlib.Pa # Ensure parent directory still exists assert await aiofiles.os.path.exists(tmp_path / "dir1") -