示例#1
0
def test_migrate_dir(td):
    src = pjoin(td, 'src')
    dst = pjoin(td, 'dst')
    os.mkdir(src)
    assert not migrate_dir(src, dst)
    assert not os.path.exists(dst)
    
    touch(pjoin(src, 'f'), 'test file')
    assert migrate_dir(src, dst)
    assert_files_equal(pjoin(src, 'f'), pjoin(dst, 'f'))
    
    touch(pjoin(src, 'g'), 'other test file')
    assert not migrate_dir(src, dst)
    assert not os.path.exists(pjoin(dst, 'g'))
    
    shutil.rmtree(dst)
    os.mkdir(dst)
    assert migrate_dir(src, dst)
    assert_files_equal(pjoin(src, 'f'), pjoin(dst, 'f'))
    assert_files_equal(pjoin(src, 'g'), pjoin(dst, 'g'))
示例#2
0
def test_migrate_dir(td):
    src = pjoin(td, 'src')
    dst = pjoin(td, 'dst')
    os.mkdir(src)
    assert not migrate_dir(src, dst)
    assert not os.path.exists(dst)

    touch(pjoin(src, 'f'), 'test file')
    assert migrate_dir(src, dst)
    assert_files_equal(pjoin(src, 'f'), pjoin(dst, 'f'))

    touch(pjoin(src, 'g'), 'other test file')
    assert not migrate_dir(src, dst)
    assert not os.path.exists(pjoin(dst, 'g'))

    shutil.rmtree(dst)
    os.mkdir(dst)
    assert migrate_dir(src, dst)
    assert_files_equal(pjoin(src, 'f'), pjoin(dst, 'f'))
    assert_files_equal(pjoin(src, 'g'), pjoin(dst, 'g'))
 def notice_m_dir(src, dst):
     called['migrate_dir'] = True
     return migrate_dir(src, dst)
示例#4
0
 def notice_m_dir(src, dst):
     called['migrate_dir'] = True
     return migrate_dir(src, dst)