Esempio n. 1
0
def test_copytree_dir_subdir_with_files(fs):
    """Test that copytree can copy a directory containing files and a
    subdirectory containing files."""
    _create_source_dir(SOURCE_DIR, fs)
    subdir_name = 'subdir'
    _create_source_dir(os.path.join(SOURCE_DIR, subdir_name), fs)
    filesystem.copytree(SOURCE_DIR, DESTINATION_DIR)
    _assert_has_source_dir_contents(DESTINATION_DIR)
    _assert_has_source_dir_contents(os.path.join(DESTINATION_DIR, subdir_name))
Esempio n. 2
0
def test_copytree_empty_dir(fs):
    """Test that copytree can copy an empty directory"""
    fs.create_dir(SOURCE_DIR)
    filesystem.copytree(SOURCE_DIR, DESTINATION_DIR)
    assert os.listdir(DESTINATION_DIR) == []
Esempio n. 3
0
def test_copytree_nonexistent_source(fs):
    """Test that copytree raises an exception if asked to copy from a
    nonexistent source directory."""
    with pytest.raises(NotADirectoryError):
        filesystem.copytree('fake1', 'fake2')
Esempio n. 4
0
def test_copytree_dir_with_files(fs):
    """Test that copytree can copy a directory containing files."""
    _create_source_dir(SOURCE_DIR, fs)
    filesystem.copytree(SOURCE_DIR, DESTINATION_DIR)
    _assert_has_source_dir_contents(DESTINATION_DIR)