call site 1 for code.Frame.eval
apigen/testing/test_apigen_functional.py - line 170
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
   def test_apigen_functional():
       #if py.std.sys.platform == "win32":
       #    py.test.skip("XXX test fails on windows")
       fs_root, package_name = setup_fs_project('test_apigen_functional')
       tempdir = py.test.ensuretemp('test_apigen_functional_results')
       pydir = py.magic.autopath().dirpath().dirpath().dirpath()
       pakdir = fs_root.join('pak')
       if py.std.sys.platform == 'win32':
           cmd = ('set APIGENPATH=%s && set PYTHONPATH=%s && '
                  'python "%s/bin/py.test"') % (tempdir, fs_root, pydir)
       else:
           cmd = ('APIGENPATH="%s" PYTHONPATH="%s" '
                  'python "%s/bin/py.test"') % (tempdir, fs_root, pydir)
       try:
           output = py.process.cmdexec('%s --apigen="%s/apigen.py" "%s"' % (
                                           cmd, fs_root, pakdir))
       except py.error.Error, e:
           print e.out
           raise
       assert output.lower().find('traceback') == -1
   
       # just some quick content checks
       apidir = tempdir.join('api')
       assert apidir.check(dir=True)
       sometestclass_api = apidir.join('main.SomeTestClass.html')
       assert sometestclass_api.check(file=True)
       html = sometestclass_api.read()
       print html
       assert '<a href="main.SomeTestClass.html">SomeTestClass</a>' in html
       assert 'someattr: <em>somevalue</em>' in html
       
       namespace_api = apidir.join('main.html')
       assert namespace_api.check(file=True)
       html = namespace_api.read()
       assert '<a href="main.SomeTestClass.html">SomeTestClass</a>' in html
       index = apidir.join('index.html')
       assert index.check(file=True)
       html = index.read()
       assert 'pkg docstring' in html
   
       sourcedir = tempdir.join('source')
       assert sourcedir.check(dir=True)
       sometestclass_source = sourcedir.join('sometestclass.py.html')
       assert sometestclass_source.check(file=True)
       html = sometestclass_source.read()
->     assert '<div class="project_title">sources for sometestclass.py</div>' in html
   
       index = sourcedir.join('index.html')
       assert index.check(file=True)
       html = index.read()
       print html
       assert '<a href="test/index.html">test</a>' in html
       assert 'href="../../py/doc/home.html"'
magic/assertion.py - line 22
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
   def __init__(self, *args):
       BuiltinAssertionError.__init__(self, *args)
       if args: 
           self.msg = str(args[0])
       else: 
           f = sys._getframe(1)
           try:
               source = py.code.Frame(f).statement
               source = str(source.deindent()).strip()
           except py.error.ENOENT:
               source = None
               # this can also occur during reinterpretation, when the
               # co_filename is set to "<run>".
           if source:
->             self.msg = exprinfo.interpret(source, f, should_fail=True)
               if not self.args:
                   self.args = (self.msg,)
           else:
               self.msg = None
magic/exprinfo.py - line 422
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
   def interpret(source, frame, should_fail=False):
       module = Interpretable(parse(source, 'exec').node)
       #print "got module", module
       if isinstance(frame, py.std.types.FrameType):
           frame = py.code.Frame(frame)
       try:
->         module.run(frame)
       except Failure, e:
           return getfailure(e)
       except passthroughex:
           raise
       except:
           import traceback
           traceback.print_exc()
       if should_fail:
           return "(inconsistently failed then succeeded)"
       else:
           return None
magic/exprinfo.py - line 382
379
380
381
382
   def run(self, frame):
       for stmt in self.nodes:
           stmt = Interpretable(stmt)
->         stmt.run(frame)
magic/exprinfo.py - line 331
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
   def run(self, frame):
       test = Interpretable(self.test)
->     test.eval(frame)
       # simplify 'assert False where False = ...'
       if (test.explanation.startswith('False\n{False = ') and
           test.explanation.endswith('\n}')):
           test.explanation = test.explanation[15:-2]
       # print the result as  'assert <explanation>'
       self.result = test.result
       self.explanation = 'assert ' + test.explanation
       if not frame.is_true(test.result):
           try:
               raise BuiltinAssertionError
           except passthroughex:
               raise
           except:
               raise Failure(self)
magic/exprinfo.py - line 126
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
   def eval(self, frame):
       expr = Interpretable(self.expr)
       expr.eval(frame)
       for operation, expr2 in self.ops:
           expr2 = Interpretable(expr2)
->         expr2.eval(frame)
           self.explanation = "%s %s %s" % (
               expr.explanation, operation, expr2.explanation)
           co = compile("__exprinfo_left %s __exprinfo_right" % operation,
                        '?', 'eval')
           try:
               self.result = frame.eval(co, __exprinfo_left=expr.result,
                                            __exprinfo_right=expr2.result)
           except passthroughex:
               raise
           except:
               raise Failure(self)
           if not frame.is_true(self.result):
               break
           expr = expr2
magic/exprinfo.py - line 114
113
114
115
116
   def eval(self, frame):
->     super(Name, self).eval(frame)
       if not self.is_local(frame):
           self.explanation = self.name
magic/exprinfo.py - line 30
23
24
25
26
27
28
29
30
31
32
33
34
35
36
   def eval(self, frame):
       # fall-back for unknown expression nodes
       try:
           expr = ast.Expression(self.__obj__)
           expr.filename = '<eval>'
           self.__obj__.filename = '<eval>'
           co = pycodegen.ExpressionCodeGenerator(expr).getCode()
->         result = frame.eval(co)
       except passthroughex:
           raise
       except:
           raise Failure(self)
       self.result = result
       self.explanation = self.explanation or frame.repr(self.result)