How to use the aiofiles.os.rename function in aiofiles

To help you get started, we’ve selected a few aiofiles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Tinche / aiofiles / tests / test_os.py View on Github external
def test_rename():
    """Test the rename call."""
    old_filename = join(dirname(__file__), 'resources', 'test_file1.txt')
    new_filename = join(dirname(__file__), 'resources', 'test_file2.txt')
    yield from aiofiles.os.rename(old_filename, new_filename)
    assert exists(old_filename) is False and exists(new_filename)
    yield from aiofiles.os.rename(new_filename, old_filename)
    assert exists(old_filename) and exists(new_filename) is False
github Tinche / aiofiles / tests / test_os.py View on Github external
def test_rename():
    """Test the rename call."""
    old_filename = join(dirname(__file__), 'resources', 'test_file1.txt')
    new_filename = join(dirname(__file__), 'resources', 'test_file2.txt')
    yield from aiofiles.os.rename(old_filename, new_filename)
    assert exists(old_filename) is False and exists(new_filename)
    yield from aiofiles.os.rename(new_filename, old_filename)
    assert exists(old_filename) and exists(new_filename) is False