def getmsg(f, extra_ns=None, must_pass=False):
 src = '\n'.join(_pytest._code.Code(f).source().lines)
 mod = rewrite(src)
 code = compile(mod, '<test>', 'exec')
 ns = {}
 if (extra_ns is not None):
  ns.update(extra_ns)
 py.builtin.exec_(code, ns)
 func = ns[f.__name__]
 try:
  func()
 except AssertionError:
  if must_pass:
   pytest.fail("shouldn't have raised")
  s = str(sys.exc_info()[1])
  if (not s.startswith('assert')):
   return ('AssertionError: ' + s)
  return s
 else:
  if (not must_pass):
   pytest.fail("function didn't raise at all")

def getmsg ( f , extra_ns = None , must_pass = False ) : src = '\n' . join ( _pytest . _code . Code ( f ) . source ( ) . lines ) mod = rewrite ( src ) code = compile ( mod , '<test>' , 'exec' ) ns = { } if ( extra_ns is not None ) : ns . update ( extra_ns ) py . builtin . exec_ ( code , ns ) func = ns [ f . __name__ ] try : func ( ) except AssertionError : if must_pass : pytest . fail ( "shouldn't have raised" ) s = str ( sys . exc_info ( ) [ 1 ] ) if ( not s . startswith ( 'assert' ) ) : return ( 'AssertionError: ' + s ) return s else : if ( not must_pass ) : pytest . fail ( "function didn't raise at all" )
rewrite the assertions in f .