call site 10 for path.local.pyimport
apigen/source/testing/test_browser.py - line 52
42
43
44
45
46
47
48
49
50
51
52
53
54
   def test_if_browser():
       tmp = py.test.ensuretemp("sourcebrowser")
       tmp.ensure("b.py").write(py.code.Source("""
           if 1:
               def f():
                   pass
           if 0:
               def g():
                   pass
       """))
->     mod = parse_path(tmp.join("b.py"))
       assert isinstance(mod.f, Function)
       py.test.raises(AttributeError, 'mod.g')
apigen/source/browser.py - line 133
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
   def parse_path(path):
       if not isinstance(path, PathBase):
           path = py.path.local(path)
       buf = path.open().read()
       st = parse(buf)
       # first go - we get all functions and classes defined on top-level
       nodes = dir_nodes(st)
       function_ast = [i for i in nodes if isinstance(i, ast.Function)]
       classes_ast = [i for i in nodes if isinstance(i, ast.Class)]
       mod_dict = dict([(i.name, function_from_ast(i, None)) for i in function_ast]
          + [(i.name, class_from_ast(i)) for i in classes_ast])
       # we check all the elements, if they're really there
       try:
->         mod = path.pyimport()
       except (KeyboardInterrupt, SystemExit):
           raise
       except:  # catch all other import problems generically
           # XXX some import problem: we probably should not
           # pretend to have an empty module 
           pass
       else:
           update_mod_dict(mod, mod_dict)
       return Module(path, mod_dict)