#115 Python 3: Tests: KeyError: "'fedmsg' not found in dict_keys(['dummy'])" not showing the "helpful message"
Closed: Fixed Opened by jskladan.

This works just fine on Python 2, but fails on Python 3:

=================================== FAILURES ===================================
________________________ TestMessaging.test_load_plugin ________________________
self = <testing.test_general.TestMessaging object at 0x7f56c8774048>
    def test_load_plugin(self):
        plugin = messaging.load_messaging_plugin('dummy', {})
        assert isinstance(plugin, messaging.DummyPlugin)
        try:
>           plugin = messaging.load_messaging_plugin('fedmsg', {})
testing/test_general.py:188: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
name = 'fedmsg', kwargs = {}
    def load_messaging_plugin(name, kwargs):
        """ Instantiate and return the appropriate messaging plugin. """
        points = pkg_resources.iter_entry_points('resultsdb.messaging.plugins')
        classes = {'dummy': DummyPlugin}
        classes.update(dict([(point.name, point.load()) for point in points]))
        log.debug("Found the following installed messaging plugin %r" % classes)
        if name not in classes:
>           raise KeyError("%r not found in %r" % (name, classes.keys()))
E           KeyError: "'fedmsg' not found in dict_keys(['dummy'])"
resultsdb/messaging.py:183: KeyError
During handling of the above exception, another exception occurred:
self = <testing.test_general.TestMessaging object at 0x7f56c8774048>
    def test_load_plugin(self):
        plugin = messaging.load_messaging_plugin('dummy', {})
        assert isinstance(plugin, messaging.DummyPlugin)
        try:
            plugin = messaging.load_messaging_plugin('fedmsg', {})
        except KeyError as err:
>           if "not found" in err.message:
E           AttributeError: 'KeyError' object has no attribute 'message'
testing/test_general.py:190: AttributeError

Looks like the KeyError no longer has message attribute, this was used to check whether the "not found" string is in there, and if it was, a helpful message (telling you to run python setup.py develop) was shown, as this is quite a common issue.

Investigate, and fix the code, so the "help" is shown even in Python 3


PR: #118

Closed by https://pagure.io/taskotron/resultsdb/c/fb31306bfa242cc130c31e7fca52f1e9742194f0?branch=develop

Metadata Update from @jskladan:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

Metadata