Ejemplo n.º 1
0
 def load_code(self, fname):
     try:
         return self.codes[fname]
     except KeyError:
         if os.path.isabs(fname):
             res = gather_all_code_objs(fname)
         else:
             if self.extrapath is None:
                 raise IOError("Cannot find %s" % fname)
             res = gather_all_code_objs(os.path.join(self.extrapath, fname))
         self.codes[fname] = res
         return res
Ejemplo n.º 2
0
 def load_code(self, fname):
     try:
         return self.codes[fname]
     except KeyError:
         if os.path.isabs(fname):
             res = gather_all_code_objs(fname)
         else:
             if self.extrapath is None:
                 raise IOError("Cannot find %s" % fname)
             res = gather_all_code_objs(os.path.join(self.extrapath, fname))
         self.codes[fname] = res
         return res
Ejemplo n.º 3
0
def test_load_code():
    py.test.skip("XXX broken, fix me")
    fname = re.__file__
    code = gather_all_code_objs(fname)[144]
    assert code.co_name == 'sub'
    assert code.co_filename == '/usr/lib/python2.6/re.py'
    assert code.co_firstlineno == 144
Ejemplo n.º 4
0
def test_gather_code_py():
    py.test.skip("XXX broken, fix me")
    fname = re.__file__
    codes = gather_all_code_objs(fname)
    assert len(codes) == 21
    assert sorted(codes.keys()) == [102, 134, 139, 144, 153, 164, 169, 181, 188, 192, 197, 206, 229, 251, 266, 271, 277, 285, 293, 294, 308]