Exemplo n.º 1
0
    def test_copytree_src_parent_of_dst(self):
        dst_path = tempfile.mkdtemp()
        src_path = os.path.abspath(os.path.join(dst_path, '..'))

        with pytest.raises(ValueError):
            os_ext.copytree(src_path, dst_path)

        shutil.rmtree(dst_path)
Exemplo n.º 2
0
    def test_copytree(self):
        dir_src = tempfile.mkdtemp()
        dir_dst = tempfile.mkdtemp()

        self.assertRaises(OSError, shutil.copytree, dir_src, dir_dst)
        try:
            os_ext.copytree(dir_src, dir_dst)
        except Exception as e:
            self.fail('custom copytree failed: %s' % e)

        shutil.rmtree(dir_src)
        shutil.rmtree(dir_dst)
Exemplo n.º 3
0
    def test_copytree(self):
        dir_src = tempfile.mkdtemp()
        dir_dst = tempfile.mkdtemp()

        with pytest.raises(OSError):
            shutil.copytree(dir_src, dir_dst)

        try:
            os_ext.copytree(dir_src, dir_dst)
        except Exception as e:
            pytest.fail('custom copytree failed: %s' % e)

        shutil.rmtree(dir_src)
        shutil.rmtree(dir_dst)
Exemplo n.º 4
0
def test_copytree_src_parent_of_dst(tmp_path):
    dst_path = tmp_path / 'dst'
    src_path = (dst_path / '..').resolve()

    with pytest.raises(ValueError):
        os_ext.copytree(str(src_path), str(dst_path))
Exemplo n.º 5
0
def test_copytree(tmp_path):
    dir_src = tmp_path / 'src'
    dir_src.mkdir()
    dir_dst = tmp_path / 'dst'
    dir_dst.mkdir()
    os_ext.copytree(str(dir_src), str(dir_dst), dirs_exist_ok=True)
Exemplo n.º 6
0
 def test_copytree(self):
     dir_src = tempfile.mkdtemp()
     dir_dst = tempfile.mkdtemp()
     os_ext.copytree(dir_src, dir_dst, dirs_exist_ok=True)
     shutil.rmtree(dir_src)
     shutil.rmtree(dir_dst)