Esempio n. 1
0
def test_non_syntax_error():
    """Typical error formatting should work and relativize paths."""
    raise SkipTest
    options = dict(term=Terminal(stream=StringIO()))
    f = ''.join(format_traceback(*attr_error_tb, **options))
    print f
    print repr(f)
    eq_(f, """  vi +2926 /usr/share/PackageKit/helpers/yum/yumBackend.py  # install_signature
    self.yumbase.getKeyForPackage(pkg, askcb = lambda x, y, z: True)
  vi +4309 /usr/lib/python2.6/site-packages/yum/__init__.py  # getKeyForPackage
    result = ts.pgpImportPubkey(misc.procgpgkey(info['raw_key']))
  vi +59   /usr/lib/python2.6/site-packages/rpmUtils/transaction.py  # __getattr__
    return self.getMethod(attr)
  vi +69   {this_file}  # getMethod
    return getattr(self.ts, method)
AttributeError: 'NoneType' object has no attribute 'pgpImportPubkey'
""".format(this_file=source_path(__file__)))
Esempio n. 2
0
def test_source_path():
    eq_(source_path('thing.py'), 'thing.py')
    eq_(source_path('thing.pyc'), 'thing.py')
    eq_(source_path('thing.pyo'), 'thing.py')
    eq_(source_path('thing$py.class'), 'thing.py')
    eq_(source_path('/all/your/thing.pyc'), '/all/your/thing.py')