Skip to content

Commit

Permalink
Add aiofiles.os.unlink
Browse files Browse the repository at this point in the history
  • Loading branch information
jpy-git authored and Tinche committed Jan 6, 2022
1 parent db6c5be commit 850a8c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/aiofiles/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ async def run(*args, loop=None, executor=None, **kwargs):
renames = wrap(os.renames)
replace = wrap(os.replace)
remove = wrap(os.remove)
unlink = wrap(os.unlink)
mkdir = wrap(os.mkdir)
makedirs = wrap(os.makedirs)
rmdir = wrap(os.rmdir)
Expand Down
12 changes: 12 additions & 0 deletions tests/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ async def test_remove():
assert exists(filename) is False


@pytest.mark.asyncio
async def test_unlink():
"""Test the unlink call."""
filename = join(dirname(__file__), "resources", "test_file2.txt")
with open(filename, "w") as f:
f.write("Test file for unlink call")

assert exists(filename)
await aiofiles.os.unlink(filename)
assert exists(filename) is False


@pytest.mark.asyncio
async def test_mkdir_and_rmdir():
"""Test the mkdir and rmdir call."""
Expand Down

0 comments on commit 850a8c0

Please sign in to comment.