def test_dynamically_emptied_directories(tmpdir):
 adir = tmpdir.join('adir').ensure(dir=True)
 bdir = adir.join('bdir').ensure(dir=True)
 some_file = bdir.join('afile')
 some_file.write('1234567890')
 base_dir = adir.strpath
 (spec, parts) = tar_partition.partition(base_dir)
 tar_paths = []
 for part in parts:
  for tar_info in part:
   rel_path = os.path.relpath(tar_info.submitted_path, base_dir)
   tar_paths.append(rel_path)
 assert ('bdir' in tar_paths)

def test_dynamically_emptied_directories ( tmpdir ) : adir = tmpdir . join ( 'adir' ) . ensure ( dir = True ) bdir = adir . join ( 'bdir' ) . ensure ( dir = True ) some_file = bdir . join ( 'afile' ) some_file . write ( '1234567890' ) base_dir = adir . strpath ( spec , parts ) = tar_partition . partition ( base_dir ) tar_paths = [ ] for part in parts : for tar_info in part : rel_path = os . path . relpath ( tar_info . submitted_path , base_dir ) tar_paths . append ( rel_path ) assert ( 'bdir' in tar_paths )
ensure empty directories in the base backup are created particularly in the case when postgresql empties the files in those directories in parallel .