[lang-ref] ( copy_file ) ( python )

def test_copy_file(pushd):
    # shutil.copyfile(b, a)
    import shutil

    os.makedirs('dir1')
    p = Path('file1.txt')
    p.touch()
    assert os.path.isfile('file1.txt')

    shutil.copyfile('file1.txt', 'dir1/file2.txt') # there is no pathlib equivalent

    assert os.path.isfile('file1.txt')
    assert os.path.isfile('dir1/file2.txt')