call site 15 for magic.AssertionError.__init__
doc/test_conftest.py - line 122
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
   def test_resolve_linkrole():
       from py.__.doc.conftest import get_apigen_relpath
       apigen_relpath = get_apigen_relpath()
       from py.__.doc.conftest import resolve_linkrole
       assert resolve_linkrole('api', 'py.foo.bar', False) == (
           'py.foo.bar', apigen_relpath + 'api/foo.bar.html')
       assert resolve_linkrole('api', 'py.foo.bar()', False) == (
           'py.foo.bar()', apigen_relpath + 'api/foo.bar.html')
       assert resolve_linkrole('api', 'py', False) == (
           'py', apigen_relpath + 'api/index.html')
->     py.test.raises(AssertionError, 'resolve_linkrole("api", "foo.bar")')
       assert resolve_linkrole('source', 'py/foo/bar.py', False) == (
           'py/foo/bar.py', apigen_relpath + 'source/foo/bar.py.html')
       assert resolve_linkrole('source', 'py/foo/', False) == (
           'py/foo/', apigen_relpath + 'source/foo/index.html')
       assert resolve_linkrole('source', 'py/', False) == (
           'py/', apigen_relpath + 'source/index.html')
       py.test.raises(AssertionError, 'resolve_linkrole("source", "/foo/bar/")')
test/raises.py - line 20
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
   def raises(ExpectedException, *args, **kwargs):
       """ raise AssertionError, if target code does not raise the expected
           exception.
       """
       assert args
       __tracebackhide__ = True 
       if isinstance(args[0], str):
           expr, = args
           assert isinstance(expr, str)
           frame = sys._getframe(1)
           loc = frame.f_locals.copy()
           loc.update(kwargs)
           #print "raises frame scope: %r" % frame.f_locals
           source = py.code.Source(expr)
           try:
->             exec source.compile() in frame.f_globals, loc
               #del __traceback__
               # XXX didn'T mean f_globals == f_locals something special?
               #     this is destroyed here ...
           except ExpectedException:
               return py.code.ExceptionInfo()
       else:
           func = args[0]
           assert callable
           try:
               func(*args[1:], **kwargs)
               #del __traceback__
           except ExpectedException:
               return py.code.ExceptionInfo()
           k = ", ".join(["%s=%r" % x for x in kwargs.items()])
           if k:
               k = ', ' + k
           expr = '%s(%r%s)' %(func.__name__, args, k)
       raise ExceptionFailure(msg="DID NOT RAISE", 
                              expr=args, expected=ExpectedException) 
None</build/buildd/codespeak-lib-0.9.1/py/test/raises.py:20> - line 1
1
-> resolve_linkrole("api", "foo.bar")
doc/conftest.py - line 292
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
   def resolve_linkrole(name, text, check=True):
       apigen_relpath = get_apigen_relpath()
       if name == 'api':
           if text == 'py':
               return ('py', apigen_relpath + 'api/index.html')
           else:
               assert text.startswith('py.'), (
->                 'api link "%s" does not point to the py package') % (text,)
               dotted_name = text
               if dotted_name.find('(') > -1:
                   dotted_name = dotted_name[:text.find('(')]
               # remove pkg root
               path = dotted_name.split('.')[1:]
               dotted_name = '.'.join(path)
               obj = py
               if check:
                   for chunk in path:
                       try:
                           obj = getattr(obj, chunk)
                       except AttributeError:
                           raise AssertionError(
                               'problem with linkrole :api:`%s`: can not resolve '
                               'dotted name %s' % (text, dotted_name,))
               return (text, apigen_relpath + 'api/%s.html' % (dotted_name,))
       elif name == 'source':
           assert text.startswith('py/'), ('source link "%s" does not point '
                                           'to the py package') % (text,)
           relpath = '/'.join(text.split('/')[1:])
           if check:
               pkgroot = py.__pkg__.getpath()
               abspath = pkgroot.join(relpath)
               assert pkgroot.join(relpath).check(), (
                       'problem with linkrole :source:`%s`: '
                       'path %s does not exist' % (text, relpath))
           if relpath.endswith('/') or not relpath:
               relpath += 'index.html'
           else:
               relpath += '.html'
           return (text, apigen_relpath + 'source/%s' % (relpath,))