def test_importplugin_error_message(testdir, pytestpm):
 testdir.syspathinsert(testdir.tmpdir)
 testdir.makepyfile(qwe="\n        # encoding: UTF-8\n        raise ImportError(u'Not possible to import: \xe2\x98\xba')\n    ")
 with pytest.raises(ImportError) as excinfo:
  pytestpm.import_plugin('qwe')
 expected = '.*Error importing plugin "qwe": Not possible to import: .'
 assert py.std.re.match(expected, str(excinfo.value))

def test_importplugin_error_message ( testdir , pytestpm ) : testdir . syspathinsert ( testdir . tmpdir ) testdir . makepyfile ( qwe = "\n        # encoding: UTF-8\n        raise ImportError(u'Not possible to import: \xe2\x98\xba')\n    " ) with pytest . raises ( ImportError ) as excinfo : pytestpm . import_plugin ( 'qwe' ) expected = '.*Error importing plugin "qwe": Not possible to import: .' assert py . std . re . match ( expected , str ( excinfo . value ) )
dont hide import errors when importing plugins and provide an easy to debug message .