def test_symlink_file(self, tmpdir): long_name = 'a' * 10 + self.filename with tmpdir.as_cwd(): fixed = check_and_fix_long_filename(long_name) assert os.path.islink(fixed) assert not fixed.endswith(long_name)
def test_symlink_dir(self, tmpdir): dirname = 'really_' * 20 + 'long_name' short_name = self.filename[-20:] path = os.path.join(dirname, short_name) with tmpdir.as_cwd(): os.makedirs(dirname) u = mda.Universe(PDB_HOLE) u.atoms.write(path) fixed = check_and_fix_long_filename(path) assert os.path.islink(fixed) assert fixed.endswith(short_name)
def test_relative(self): abspath = os.path.abspath(self.filename) if len(abspath) > self.max_length: fixed = check_and_fix_long_filename(abspath) assert fixed == self.filename
def test_short(self): fixed = check_and_fix_long_filename(self.filename) assert self.filename == fixed