def with_requires(*requirements):
 ws = pkg_resources.WorkingSet()
 try:
  ws.require(*requirements)
  skip = False
 except pkg_resources.VersionConflict:
  skip = True
 msg = 'requires: {}'.format(','.join(requirements))
 return unittest.skipIf(skip, msg)

def with_requires ( * requirements ) : ws = pkg_resources . WorkingSet ( ) try : ws . require ( * requirements ) skip = False except pkg_resources . VersionConflict : skip = True msg = 'requires: {}' . format ( ',' . join ( requirements ) ) return unittest . skipIf ( skip , msg )
run a test case only when given requirements are satisfied .