def test_children_onlyfiles(self, remote_tmpdir: DriveFolder): remote_folder = remote_tmpdir.mkdir(random_string()) remote_file = remote_tmpdir.new_file(random_string()) remote_file.upload_empty() filelist = list(remote_tmpdir.children(folders=False)) assert remote_folder not in filelist assert remote_file in filelist
def test_child_all(self, remote_tmpdir: DriveFolder): foldername = random_string() folder = remote_tmpdir.mkdir(foldername) assert folder == remote_tmpdir.child(foldername) filename = random_string() file_ = remote_tmpdir.new_file(filename) file_.upload_empty() assert file_ == remote_tmpdir.child(filename)
def remote_tmp_subdir(remote_tmpdir: DriveFolder) -> DriveFolder: subdir = remote_tmpdir.mkdir(random_string()) yield subdir subdir.remove()
def test_mkdir_exists_file(self, remote_tmpdir: DriveFolder): foldername = random_string() remote_tmpdir.new_file(foldername).upload_empty() with pytest.raises(FileExistsError): remote_tmpdir.mkdir(foldername)
def test_mkdir_exists_folder(self, remote_tmpdir: DriveFolder): foldername = random_string() folder1 = remote_tmpdir.mkdir(foldername) folder2 = remote_tmpdir.mkdir(foldername) assert folder1 == folder2