def require_version(version):
 def check_require_version(f):
  version_elements = version.split('.')
  try:
   compare = tuple([int(v) for v in version_elements])
  except ValueError:
   raise ValueError(('%s is not a correct version : should be X.Y[.Z].' % version))
  current = sys.version_info[:3]
  if (current < compare):
   def new_f(self, *args, **kwargs):
    self.skipTest(('Need at least %s version of python. Current version is %s.' % (version, '.'.join([str(element) for element in current]))))
   new_f.__name__ = f.__name__
   return new_f
  else:
   return f
 return check_require_version

def require_version ( version ) : def check_require_version ( f ) : version_elements = version . split ( '.' ) try : compare = tuple ( [ int ( v ) for v in version_elements ] ) except ValueError : raise ValueError ( ( '%s is not a correct version : should be X.Y[.Z].' % version ) ) current = sys . version_info [ : 3 ] if ( current < compare ) : def new_f ( self , * args , ** kwargs ) : self . skipTest ( ( 'Need at least %s version of python. Current version is %s.' % ( version , '.' . join ( [ str ( element ) for element in current ] ) ) ) ) new_f . __name__ = f . __name__ return new_f else : return f return check_require_version
compare version of python interpreter to the given one .