Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue a warning is no fedmsg.meta plugins are installed

Fixes #233
  • Loading branch information...
commit 184647b8a14e5dd1a4577e0778bbea4c4d36be35 1 parent 88d7a91
@ralphbean ralphbean authored
Showing with 34 additions and 0 deletions.
  1. +7 −0 fedmsg/meta/__init__.py
  2. +27 −0 fedmsg/tests/test_meta.py
View
7 fedmsg/meta/__init__.py
@@ -97,6 +97,13 @@ def make_processors(**config):
# This should always be last
processors.append(DefaultProcessor(_, **config))
+ # By default we have three builtin processors: Default, Logger, and
+ # Announce. If these are the only three, then we didn't find any
+ # externally provided ones. calls to msg2subtitle and msg2link likely will
+ # not work the way the user is expecting.
+ if len(processors) == 3:
+ log.warn("No fedmsg.meta plugins found. fedmsg.meta.msg2* crippled")
+
def msg2processor(msg, **config):
""" For a given message return the text processor that can handle it.
View
27 fedmsg/tests/test_meta.py
@@ -51,6 +51,33 @@ def inner(self):
return wrapper
+class TestForWarning(unittest.TestCase):
+ def setUp(self):
+ dirname = os.path.abspath(os.path.dirname(__file__))
+ self.config = fedmsg.config.load_config(
+ filenames=[os.path.join(dirname, "fedmsg-test-config.py")],
+ invalidate_cache=True,
+ )
+ self.config['topic_prefix'] = 'org.fedoraproject'
+ self.config['topic_prefix_re'] = '^org\.fedoraproject\.(dev|stg|prod)'
+
+ def test_for_no_plugins(self):
+ """ Test that we print a warning if no plugin is installed """
+ messages = []
+
+ def mocked_warning(message):
+ messages.append(message)
+
+ expected = 'No fedmsg.meta plugins found. fedmsg.meta.msg2* crippled'
+ original = fedmsg.meta.log.warn
+ try:
+ fedmsg.meta.log.warn = mocked_warning
+ fedmsg.meta.make_processors(**self.config)
+ eq_(messages, [expected])
+ finally:
+ fedmsg.meta.log.warn = original
+
+
class Base(unittest.TestCase):
msg = None
expected_title = None
Please sign in to comment.
Something went wrong with that request. Please try again.