'Test our ability to read the correct casing from filesystem.'

def testFileCasing(self):

    try:
        os.lstat(os.path.join(self.base_path, 'nUmBeRs.txt'))
        os.lstat(os.path.join(self.base_path, 'nuMbErs.txt'))
        logging.warning('Case    insensitive    file    system    detected.    Skipping    test.')
        return
    except (IOError, OSError):
        pass
    with utils.TempDirectory() as temp_dir:
        path1 = os.path.join(temp_dir, 'numbers.txt')
        shutil.copy(os.path.join(self.base_path, 'numbers.txt'), path1)
        path2 = os.path.join(temp_dir, 'numbers.TXT')
        shutil.copy(os.path.join(self.base_path, 'numbers.txt.ver2'), path2)
        fd = vfs.VFSOpen(rdf_paths.PathSpec(path=path1, pathtype=rdf_paths.PathSpec.PathType.OS))
        self.assertEqual(fd.pathspec.Basename(), 'numbers.txt')
        fd = vfs.VFSOpen(rdf_paths.PathSpec(path=path2, pathtype=rdf_paths.PathSpec.PathType.OS))
        self.assertEqual(fd.pathspec.Basename(), 'numbers.TXT')
        path = os.path.join(self.base_path, 'Numbers.txt')
        fd = vfs.VFSOpen(rdf_paths.PathSpec(path=path, pathtype=rdf_paths.PathSpec.PathType.OS))
        read_path = fd.pathspec.Basename()
        if ((read_path != 'numbers.txt') and (read_path != 'numbers.TXT')):
            raise RuntimeError(('read    path    is    %s' % read_path))
        s = fd.Stat()
        self.assertEqual(s.pathspec.path_options, rdf_paths.PathSpec.Options.CASE_LITERAL)
        pathspec = rdf_paths.PathSpec(path=path, pathtype=rdf_paths.PathSpec.PathType.OS, path_options=rdf_paths.PathSpec.Options.CASE_LITERAL)
        self.assertRaises(IOError, vfs.VFSOpen, pathspec)
