try: import paste except ImportError: raise ImportError( "You must install paste to run the tests") from obconfloader import load_ob from altloader import fail_load_ob def test_egg(): obj, group = load_ob('egg Paste:error_catcher', ['paste.filter_app_factory', 'paste.app_factory']) assert group == 'paste.filter_app_factory' # We get some functiony thing back: assert isinstance(obj, type(test_egg)) exc = fail_load_ob('egg Paste:foobar', ['paste.filter_app_factory']) assert 'entry point foobar' in str(exc) exc = fail_load_ob('egg BazBarFooism') assert 'Egg object references are not supported' in str(exc) exc = fail_load_ob('egg BazBarFooism', groups=['test.something']) assert 'The distribution' in str(exc) and 'not found' in str(exc) exc = fail_load_ob('egg BazBarFooism', position='file.ini') assert 'file.ini' in str(exc) exc = fail_load_ob('egg BazBarFooism', position=('file.ini', 10)) assert 'file.ini line 10' in str(exc)