call site 0 for magic.patch
test/rsession/testing/test_lsession.py - line 215
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
   def test_module_raising(self):
       tmpdir = tmp
       tmpdir.ensure("sub5", "__init__.py")
       tmpdir.ensure("sub5", "test_some.py").write(py.code.Source("""
               1/0
           """))
       tmpdir.ensure("sub5", "test_other.py").write(py.code.Source("""
               import py
               py.test.skip("reason")
           """))
           
       args = [str(tmpdir.join("sub5"))]
       config = py.test.config._reparse(args)
       lsession = LSession(config)
       allevents = []
->     lsession.main(reporter=allevents.append, runner=box_runner)
       testevents = [x for x in allevents 
                       if isinstance(x, repevent.ReceivedItemOutcome)]
       assert len(testevents) == 0
       failedtryiter = [x for x in allevents 
                       if isinstance(x, repevent.FailedTryiter)]
       assert len(failedtryiter) == 1
       skippedtryiter = [x for x in allevents 
                       if isinstance(x, repevent.SkippedTryiter)]
       assert len(skippedtryiter) == 1
test/rsession/rsession.py - line 188
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
   def main(self, reporter=None, runner=None):
       # check out if used options makes any sense
       args = self.config.args  
          
       hm = HostManager(self.config, hosts=[HostInfo('localhost')])
       hosts = hm.hosts
       if not self.config.option.nomagic:
->         py.magic.invoke(assertion=1)
   
       reporter, startserverflag = self.init_reporter(reporter, 
           hosts, LocalReporter, args[0])
       reporter, checkfun = self.wrap_reporter(reporter)
           
       reporter(repevent.TestStarted(hosts, self.config.topdir, []))
       colitems = self.config.getcolitems()
       reporter(repevent.RsyncFinished())
   
       if runner is None:
           runner = self.init_runner()
   
       keyword = self.config.option.keyword
   
       itemgenerator = itemgen(colitems, reporter, keyword, self.reporterror)
       local_loop(self, reporter, itemgenerator, checkfun, self.config, runner=runner)
           
       retval = reporter(repevent.TestFinished())
       self.kill_server(startserverflag)
   
       if not self.config.option.nomagic:
           py.magic.revoke(assertion=1)
   
       self.write_docs()
       return retval
magic/invoke.py - line 14
4
5
6
7
8
9
10
11
12
13
14
15
16
   def invoke(assertion=False, compile=False):
       """ invoke magic, currently you can specify:
   
           assertion  patches the builtin AssertionError to try to give
                      more meaningful AssertionErrors, which by means
                      of deploying a mini-interpreter constructs
                      a useful error message.
       """
       if assertion:
           from py.__.magic import assertion
->         assertion.invoke()
       if compile: 
           py.magic.patch(cpy_builtin, 'compile', py.code.compile )
magic/assertion.py - line 29
28
29
   def invoke():
->     py.magic.patch(__builtin__, 'AssertionError', AssertionError)