Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefaultConfigMixin: Modify implementation #597

Merged
merged 3 commits into from
Aug 12, 2018
Merged

Conversation

nvzard
Copy link
Member

@nvzard nvzard commented Aug 4, 2018

Store the default values in CONFIG_TEMPLATE and
then allow a subset of those config variables
overridden in the config.py's DEFAULT_CONFIG.

Closes #596

@nvzard nvzard changed the title DefaultConfigurationMixin: Modify implementation DefaultConfigMixin: Modify implementation Aug 4, 2018
@@ -38,8 +38,7 @@ def setUp(self):
extra_config = {
'DEFAULT_CONFIG': {
'SpammingAlert': {
'MAX_MSG_LEN': 500,
'MAX_LINES': 5,
'MAX_MSG_LEN': 50,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change from 500 to 50?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

misjudgement

@TravisBuddy
Copy link

Travis tests have failed

Hey @nvzard,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

1st Build

python -m pytest
============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-3.6.4, py-1.5.2, pluggy-0.6.0
rootdir: /home/travis/build/coala/corobo, inifile: setup.cfg
plugins: requests-mock-1.5.2, xdist-1.22.5, travis-fold-1.3.0, timeout-1.3.1, reqs-0.0.7, reorder-0.1.1, profiling-1.3.0, mock-1.10.0, instafail-0.3.0, forked-0.2, error-for-skips-1.0.0, env-0.6.2, cov-2.5.1
collected 40 items                                                             

tests/answer_test.py .                                                   [  2%]
tests/ban_test.py ..                                                     [  7%]
tests/coala_lowercase_c_test.py ..                                       [ 12%]
tests/coatils_test.py ...........                                        [ 40%]
tests/deprecate_bot_prefixes_test.py .                                   [ 42%]
tests/explain_test.py .                                                  [ 45%]
tests/ghetto_test.py .                                                   [ 47%]
tests/git_stats_test.py .                                                [ 50%]
tests/labhub_test.py .........                                           [ 72%]
tests/lmgtfy_test.py .                                                   [ 75%]
tests/nevermind_test.py .                                                [ 77%]
tests/pitchfork_test.py .                                                [ 80%]
tests/searchdocs_test.py E                                               [ 82%]
tests/ship_it_test.py .                                                  [ 85%]
tests/spam_test.py ....                                                  [ 95%]
tests/the_rules_test.py .                                                [ 97%]
tests/wolfram_alpha_test.py .                                            [100%]

==================================== ERRORS ====================================
______________________ ERROR at setup of test_search_cmd _______________________

request = <SubRequest 'testbot' for <Function 'test_search_cmd'>>

    @pytest.fixture
    def testbot(request) -> TestBot:
        """
        Pytest fixture to write tests against a fully functioning bot.
    
        For example, if you wanted to test the builtin `!about` command,
        you could write a test file with the following::
    
            def test_about(testbot):
                testbot.push_message('!about')
                assert "Err version" in testbot.pop_message()
    
        It's possible to provide additional configuration to this fixture,
        by setting variables at module level or as class attributes (the
        latter taking precedence over the former). For example::
    
            extra_plugin_dir = '/foo/bar'
    
            def test_about(testbot):
                testbot.push_message('!about')
                assert "Err version" in testbot.pop_message()
    
        ..or::
    
            extra_plugin_dir = '/foo/bar'
    
            class Tests(object):
                # Wins over `extra_plugin_dir = '/foo/bar'` above
                extra_plugin_dir = '/foo/baz'
    
                def test_about(self, testbot):
                    testbot.push_message('!about')
                    assert "Err version" in testbot.pop_message()
    
        ..to load additional plugins from the directory `/foo/bar` or
        `/foo/baz` respectively. This works for the following items, which are
        passed to the constructor of :class:`~errbot.backends.test.TestBot`:
    
        * `extra_plugin_dir`
        * `loglevel`
        """
    
        def on_finish():
            bot.stop()
    
        #  setup the logging to something digestable.
        logger = logging.getLogger('')
        logging.getLogger('MARKDOWN').setLevel(logging.ERROR)  # this one is way too verbose in debug
        logger.setLevel(logging.DEBUG)
        console_hdlr = logging.StreamHandler(sys.stdout)
        console_hdlr.setFormatter(logging.Formatter("%(levelname)-8s %(name)-25s %(message)s"))
        logger.handlers = []
        logger.addHandler(console_hdlr)
    
        kwargs = {}
    
        for attr, default in (('extra_plugin_dir', None), ('extra_config', None), ('loglevel', logging.DEBUG),):
            if hasattr(request, 'instance'):
                kwargs[attr] = getattr(request.instance, attr, None)
            if kwargs[attr] is None:
                kwargs[attr] = getattr(request.module, attr, default)
    
        bot = TestBot(**kwargs)
>       bot.start()

../../../virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/backends/test.py:584: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/backends/test.py:405: in start
    if self.bot.pop_message(timeout=1) == "ready":
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/backends/test.py:308: in pop_message
    return self.outgoing_message_queue.get(timeout=timeout, block=block)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <queue.Queue object at 0x7f5105670e80>, block = True, timeout = 1

    def get(self, block=True, timeout=None):
        '''Remove and return an item from the queue.
    
            If optional args 'block' is true and 'timeout' is None (the default),
            block if necessary until an item is available. If 'timeout' is
            a non-negative number, it blocks at most 'timeout' seconds and raises
            the Empty exception if no item was available within that time.
            Otherwise ('block' is false), return an item if one is immediately
            available, else raise the Empty exception ('timeout' is ignored
            in that case).
            '''
        with self.not_empty:
            if not block:
                if not self._qsize():
                    raise Empty
            elif timeout is None:
                while not self._qsize():
                    self.not_empty.wait()
            elif timeout < 0:
                raise ValueError("'timeout' must be a non-negative number")
            else:
                endtime = time() + timeout
                while not self._qsize():
                    remaining = endtime - time()
                    if remaining <= 0.0:
>                       raise Empty
E                       queue.Empty

/opt/python/3.6.3/lib/python3.6/queue.py:172: Empty
travis_fold:start:py-5506.stdout-setup.0
---------------------------- Captured stdout setup -----------------------------
INFO     errbot.bootstrap          Found Storage plugin: Memory.
INFO     errbot.bootstrap          Found Backend plugin: Test
DEBUG    errbot.storage            Opening storage 'repomgr'
DEBUG    errbot.core               ErrBot init.
DEBUG    errbot.backends.base      Backend init.
DEBUG    errbot.core               created a thread pool of size 10.
DEBUG    errbot.storage            Opening storage 'core'
DEBUG    errbot.core               Initializing backend storage
DEBUG    errbot.storage            Opening storage 'test_backend'
DEBUG    errbot.plugin_manager     New entries added to sys.path:
DEBUG    errbot.plugins.Backup     Logger for plugin initialized...
DEBUG    errbot.plugins.TextCmds   Logger for plugin initialized...
DEBUG    errbot.plugins.Utils      Logger for plugin initialized...
DEBUG    errbot.plugins.ACLs       Logger for plugin initialized...
DEBUG    errbot.plugins.Help       Logger for plugin initialized...
INFO     errbot                    webhooks:  Flag to bind /echo to echo
DEBUG    errbot.plugins.Webserver  Logger for plugin initialized...
DEBUG    errbot.plugins.ChatRoom   Logger for plugin initialized...
DEBUG    errbot.plugins.VersionChecker Logger for plugin initialized...
DEBUG    errbot.plugins.Health     Logger for plugin initialized...
DEBUG    errbot.plugins.Flows      Logger for plugin initialized...
DEBUG    errbot.plugins.CommandNotFoundFilter Logger for plugin initialized...
DEBUG    errbot.plugins.Plugins    Logger for plugin initialized...
DEBUG    errbot.plugins.pitchfork  Logger for plugin initialized...
DEBUG    errbot.plugins.deprecate_bot_prefixes Logger for plugin initialized...
DEBUG    errbot.plugins.explain    Logger for plugin initialized...
DEBUG    errbot.plugins.the_rules  Logger for plugin initialized...
DEBUG    errbot.plugins.ship_it    Logger for plugin initialized...
DEBUG    errbot.plugins.lmgtfy     Logger for plugin initialized...
DEBUG    errbot.plugins.coatils    Logger for plugin initialized...
DEBUG    errbot.plugins.ghetto     Logger for plugin initialized...
DEBUG    errbot.plugins.LabHub     Logger for plugin initialized...
INFO     github3                   Building a url from ('https://api.github.com', 'orgs', 'coala')
DEBUG    github3                   GET https://api.github.com/orgs/coala with {}
DEBUG    urllib3.connectionpool    Starting new HTTPS connection (1): api.github.com:443
DEBUG    urllib3.connectionpool    https://api.github.com:443 "GET /orgs/coala HTTP/1.1" 401 83
DEBUG    errbot.plugins.nevermind  Logger for plugin initialized...
DEBUG    errbot.plugins.SpammingAlert Logger for plugin initialized...
DEBUG    errbot.plugins.wolfram alpha Logger for plugin initialized...
DEBUG    errbot.plugins.Ban        Logger for plugin initialized...
DEBUG    errbot.plugins.coala_lowercase_c Logger for plugin initialized...
DEBUG    errbot.plugins.GitStats   Logger for plugin initialized...
DEBUG    errbot.plugins.SearchDocs Logger for plugin initialized...
DEBUG    errbot.plugins.answer     Logger for plugin initialized...
ERROR    errbot.bootstrap          Some plugins failed to load:
Contains more than one plugin, only one will be loaded.
INFO     errbot.core               Activate internal commands
INFO     errbot.plugin_manager     Activate bot plugins...
INFO     errbot.plugin_manager     Activate plugin: Backup.
DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
DEBUG    errbot.botplugin          Init storage for Backup.
DEBUG    errbot.storage            Opening storage 'Backup'
DEBUG    errbot.core               Adding command : backup -> backup.
INFO     errbot.core_plugins.wsview Checking Backup for webhooks
INFO     errbot.plugin_manager     Activate plugin: TextCmds.
DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
INFO     errbot.core_plugins.wsview Checking TextModeCmds for webhooks
INFO     errbot.plugin_manager     Activate plugin: Utils.
DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
DEBUG    errbot.botplugin          Init storage for Utils.
DEBUG    errbot.storage            Opening storage 'Utils'
DEBUG    errbot.core               Adding command : echo -> echo.
DEBUG    errbot.core               Adding command : history -> history.
DEBUG    errbot.core               Adding command : log_tail -> log_tail.
DEBUG    errbot.core               Adding command : render_test -> render_test.
DEBUG    errbot.core               Adding command : whoami -> whoami.
INFO     errbot.core_plugins.wsview Checking Utils for webhooks
INFO     errbot.plugin_manager     Activate plugin: ACLs.
DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
DEBUG    errbot.botplugin          Init storage for ACLs.
DEBUG    errbot.storage            Opening storage 'ACLs'
DEBUG    errbot.core               Adding command filter: acls
INFO     errbot.core_plugins.wsview Checking ACLS for webhooks
INFO     errbot.plugin_manager     Activate plugin: Help.
DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
DEBUG    errbot.botplugin          Init storage for Help.
DEBUG    errbot.storage            Opening storage 'Help'
DEBUG    errbot.core               Adding command : about -> about.
DEBUG    errbot.core               Adding command : apropos -> apropos.
DEBUG    errbot.core               Adding command : help -> help.
INFO     errbot.core_plugins.wsview Checking Help for webhooks
INFO     errbot.plugin_manager     Activate plugin: Webserver.
DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
INFO     errbot.plugins.Webserver  Webserver is not configured. Forbid activation
INFO     errbot.core_plugins.wsview Checking Webserver for webhooks
INFO     errbot.core_plugins.wsview Webhook routing echo
INFO     errbot.plugin_manager     Activate plugin: ChatRoom.
DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
DEBUG    errbot.botplugin          Init storage for ChatRoom.
DEBUG    errbot.storage            Opening storage 'ChatRoom'
DEBUG    errbot.core               Adding command : room_create -> room_create.
DEBUG    errbot.core               Adding command : room_destroy -> room_destroy.
DEBUG    errbot.core               Adding command : room_invite -> room_invite.
DEBUG    errbot.core               Adding command : room_join -> room_join.
DEBUG    errbot.core               Adding command : room_leave -> room_leave.
DEBUG    errbot.core               Adding command : room_list -> room_list.
DEBUG    errbot.core               Adding command : room_occupants -> room_occupants.
DEBUG    errbot.core               Adding command : room_topic -> room_topic.
INFO     errbot.core_plugins.wsview Checking ChatRoom for webhooks
INFO     errbot.plugins.ChatRoom   Callback_connect
DEBUG    errbot.plugins.ChatRoom   Try to join room 'testroom'
INFO     errbot.plugins.ChatRoom   Joining room testroom with username Errbot.
travis_fold:end:py-5506.stdout-setup.0
travis_fold:start:py-5506.stderr-setup.0
---------------------------- Captured stderr setup -----------------------------
2018-08-04 19:55:08,097 INFO     errbot.bootstrap          Found Storage plugin: Memory.
2018-08-04 19:55:08,103 INFO     errbot.bootstrap          Found Backend plugin: Test
2018-08-04 19:55:08,103 DEBUG    errbot.storage            Opening storage 'repomgr'
2018-08-04 19:55:08,106 DEBUG    errbot.core               ErrBot init.
2018-08-04 19:55:08,106 DEBUG    errbot.backends.base      Backend init.
2018-08-04 19:55:08,109 DEBUG    errbot.core               created a thread pool of size 10.
2018-08-04 19:55:08,111 DEBUG    errbot.storage            Opening storage 'core'
2018-08-04 19:55:08,112 DEBUG    errbot.core               Initializing backend storage
2018-08-04 19:55:08,112 DEBUG    errbot.storage            Opening storage 'test_backend'
2018-08-04 19:55:08,117 DEBUG    errbot.plugin_manager     New entries added to sys.path:
2018-08-04 19:55:08,118 DEBUG    errbot.plugins.Backup     Logger for plugin initialized...
2018-08-04 19:55:08,119 DEBUG    errbot.plugins.TextCmds   Logger for plugin initialized...
2018-08-04 19:55:08,120 DEBUG    errbot.plugins.Utils      Logger for plugin initialized...
2018-08-04 19:55:08,121 DEBUG    errbot.plugins.ACLs       Logger for plugin initialized...
2018-08-04 19:55:08,122 DEBUG    errbot.plugins.Help       Logger for plugin initialized...
2018-08-04 19:55:08,125 INFO     errbot                    webhooks:  Flag to bind /echo to echo
2018-08-04 19:55:08,125 DEBUG    errbot.plugins.Webserver  Logger for plugin initialized...
2018-08-04 19:55:08,126 DEBUG    errbot.plugins.ChatRoom   Logger for plugin initialized...
2018-08-04 19:55:08,127 DEBUG    errbot.plugins.VersionChecker Logger for plugin initialized...
2018-08-04 19:55:08,130 DEBUG    errbot.plugins.Health     Logger for plugin initialized...
2018-08-04 19:55:08,133 DEBUG    errbot.plugins.Flows      Logger for plugin initialized...
2018-08-04 19:55:08,134 DEBUG    errbot.plugins.CommandNotFoundFilter Logger for plugin initialized...
2018-08-04 19:55:08,136 DEBUG    errbot.plugins.Plugins    Logger for plugin initialized...
2018-08-04 19:55:08,137 DEBUG    errbot.plugins.pitchfork  Logger for plugin initialized...
2018-08-04 19:55:08,138 DEBUG    errbot.plugins.deprecate_bot_prefixes Logger for plugin initialized...
2018-08-04 19:55:08,139 DEBUG    errbot.plugins.explain    Logger for plugin initialized...
2018-08-04 19:55:08,141 DEBUG    errbot.plugins.the_rules  Logger for plugin initialized...
2018-08-04 19:55:08,142 DEBUG    errbot.plugins.ship_it    Logger for plugin initialized...
2018-08-04 19:55:08,143 DEBUG    errbot.plugins.lmgtfy     Logger for plugin initialized...
2018-08-04 19:55:08,167 DEBUG    errbot.plugins.coatils    Logger for plugin initialized...
2018-08-04 19:55:08,168 DEBUG    errbot.plugins.ghetto     Logger for plugin initialized...
2018-08-04 19:55:08,169 DEBUG    errbot.plugins.LabHub     Logger for plugin initialized...
2018-08-04 19:55:08,170 INFO     github3                   Building a url from ('https://api.github.com', 'orgs', 'coala')
2018-08-04 19:55:08,170 DEBUG    github3                   GET https://api.github.com/orgs/coala with {}
2018-08-04 19:55:08,173 DEBUG    urllib3.connectionpool    Starting new HTTPS connection (1): api.github.com:443
2018-08-04 19:55:08,309 DEBUG    urllib3.connectionpool    https://api.github.com:443 "GET /orgs/coala HTTP/1.1" 401 83
2018-08-04 19:55:08,315 DEBUG    errbot.plugins.nevermind  Logger for plugin initialized...
2018-08-04 19:55:08,316 DEBUG    errbot.plugins.SpammingAlert Logger for plugin initialized...
2018-08-04 19:55:08,318 DEBUG    errbot.plugins.wolfram alpha Logger for plugin initialized...
2018-08-04 19:55:08,319 DEBUG    errbot.plugins.Ban        Logger for plugin initialized...
2018-08-04 19:55:08,320 DEBUG    errbot.plugins.coala_lowercase_c Logger for plugin initialized...
2018-08-04 19:55:08,321 DEBUG    errbot.plugins.GitStats   Logger for plugin initialized...
2018-08-04 19:55:08,322 DEBUG    errbot.plugins.SearchDocs Logger for plugin initialized...
2018-08-04 19:55:08,325 DEBUG    errbot.plugins.answer     Logger for plugin initialized...
2018-08-04 19:55:08,326 ERROR    errbot.bootstrap          Some plugins failed to load:
Contains more than one plugin, only one will be loaded.
2018-08-04 19:55:08,327 INFO     errbot.core               Activate internal commands
2018-08-04 19:55:08,327 INFO     errbot.plugin_manager     Activate bot plugins...
2018-08-04 19:55:08,327 INFO     errbot.plugin_manager     Activate plugin: Backup.
2018-08-04 19:55:08,327 DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
2018-08-04 19:55:08,328 DEBUG    errbot.botplugin          Init storage for Backup.
2018-08-04 19:55:08,328 DEBUG    errbot.storage            Opening storage 'Backup'
2018-08-04 19:55:08,328 DEBUG    errbot.core               Adding command : backup -> backup.
2018-08-04 19:55:08,329 INFO     errbot.core_plugins.wsview Checking Backup for webhooks
2018-08-04 19:55:08,329 INFO     errbot.plugin_manager     Activate plugin: TextCmds.
2018-08-04 19:55:08,329 DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
2018-08-04 19:55:08,329 INFO     errbot.core_plugins.wsview Checking TextModeCmds for webhooks
2018-08-04 19:55:08,330 INFO     errbot.plugin_manager     Activate plugin: Utils.
2018-08-04 19:55:08,330 DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
2018-08-04 19:55:08,330 DEBUG    errbot.botplugin          Init storage for Utils.
2018-08-04 19:55:08,330 DEBUG    errbot.storage            Opening storage 'Utils'
2018-08-04 19:55:08,331 DEBUG    errbot.core               Adding command : echo -> echo.
2018-08-04 19:55:08,331 DEBUG    errbot.core               Adding command : history -> history.
2018-08-04 19:55:08,331 DEBUG    errbot.core               Adding command : log_tail -> log_tail.
2018-08-04 19:55:08,331 DEBUG    errbot.core               Adding command : render_test -> render_test.
2018-08-04 19:55:08,331 DEBUG    errbot.core               Adding command : whoami -> whoami.
2018-08-04 19:55:08,332 INFO     errbot.core_plugins.wsview Checking Utils for webhooks
2018-08-04 19:55:08,332 INFO     errbot.plugin_manager     Activate plugin: ACLs.
2018-08-04 19:55:08,332 DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
2018-08-04 19:55:08,332 DEBUG    errbot.botplugin          Init storage for ACLs.
2018-08-04 19:55:08,333 DEBUG    errbot.storage            Opening storage 'ACLs'
2018-08-04 19:55:08,333 DEBUG    errbot.core               Adding command filter: acls
2018-08-04 19:55:08,333 INFO     errbot.core_plugins.wsview Checking ACLS for webhooks
2018-08-04 19:55:08,334 INFO     errbot.plugin_manager     Activate plugin: Help.
2018-08-04 19:55:08,334 DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
2018-08-04 19:55:08,334 DEBUG    errbot.botplugin          Init storage for Help.
2018-08-04 19:55:08,334 DEBUG    errbot.storage            Opening storage 'Help'
2018-08-04 19:55:08,335 DEBUG    errbot.core               Adding command : about -> about.
2018-08-04 19:55:08,335 DEBUG    errbot.core               Adding command : apropos -> apropos.
2018-08-04 19:55:08,335 DEBUG    errbot.core               Adding command : help -> help.
2018-08-04 19:55:08,336 INFO     errbot.core_plugins.wsview Checking Help for webhooks
2018-08-04 19:55:08,336 INFO     errbot.plugin_manager     Activate plugin: Webserver.
2018-08-04 19:55:08,337 DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
2018-08-04 19:55:08,337 INFO     errbot.plugins.Webserver  Webserver is not configured. Forbid activation
2018-08-04 19:55:08,337 INFO     errbot.core_plugins.wsview Checking Webserver for webhooks
2018-08-04 19:55:08,338 INFO     errbot.core_plugins.wsview Webhook routing echo
2018-08-04 19:55:08,338 INFO     errbot.plugin_manager     Activate plugin: ChatRoom.
2018-08-04 19:55:08,338 DEBUG    errbot.templating         Templates directory found for this plugin [/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/errbot/core_plugins/templates]
2018-08-04 19:55:08,339 DEBUG    errbot.botplugin          Init storage for ChatRoom.
2018-08-04 19:55:08,339 DEBUG    errbot.storage            Opening storage 'ChatRoom'
2018-08-04 19:55:08,339 DEBUG    errbot.core               Adding command : room_create -> room_create.
2018-08-04 19:55:08,339 DEBUG    errbot.core               Adding command : room_destroy -> room_destroy.
2018-08-04 19:55:08,339 DEBUG    errbot.core               Adding command : room_invite -> room_invite.
2018-08-04 19:55:08,340 DEBUG    errbot.core               Adding command : room_join -> room_join.
2018-08-04 19:55:08,340 DEBUG    errbot.core               Adding command : room_leave -> room_leave.
2018-08-04 19:55:08,340 DEBUG    errbot.core               Adding command : room_list -> room_list.
2018-08-04 19:55:08,340 DEBUG    errbot.core               Adding command : room_occupants -> room_occupants.
2018-08-04 19:55:08,340 DEBUG    errbot.core               Adding command : room_topic -> room_topic.
2018-08-04 19:55:08,340 INFO     errbot.core_plugins.wsview Checking ChatRoom for webhooks
2018-08-04 19:55:08,341 INFO     errbot.plugins.ChatRoom   Callback_connect
2018-08-04 19:55:08,341 DEBUG    errbot.plugins.ChatRoom   Try to join room 'testroom'
2018-08-04 19:55:08,341 INFO     errbot.plugins.ChatRoom   Joining room testroom with username Errbot.
2018-08-04 19:55:08,341 DEBUG    errbot.backends.test      Room testroom doesn't exist yet, creating it.
2018-08-04 19:55:09,837 INFO     errbot.backends.test      Created room testroom.
2018-08-04 19:55:09,837 INFO     errbot.backends.test      Joined room testroom.
2018-08-04 19:55:09,837 DEBUG    errbot.core               Triggering callback_room_joined on Backup.
travis_fold:end:py-5506.stderr-setup.0

travis_fold:start:py-5506.cov.0
----------- coverage: platform linux, python 3.6.3-final-0 -----------
Name                                Stmts   Miss  Cover   Missing
-----------------------------------------------------------------
plugins/__init__.py                     0      0   100%
plugins/answer.py                      25      0   100%
plugins/ban.py                         37      0   100%
plugins/coala_lowercase_c.py           12      0   100%
plugins/coatils.py                    118      0   100%
plugins/constants.py                    7      0   100%
plugins/deprecate_bot_prefixes.py       6      0   100%
plugins/explain.py                     20      0   100%
plugins/ghetto.py                      10      0   100%
plugins/git_stats.py                   51      0   100%
plugins/labhub.py                     236      0   100%
plugins/lmgtfy.py                       4      0   100%
plugins/nevermind.py                    5      0   100%
plugins/pitchfork.py                   12      0   100%
plugins/searchdocs.py                  16      9    44%   23-34
plugins/ship_it.py                      7      0   100%
plugins/spam.py                        13      0   100%
plugins/the_rules.py                    5      0   100%
plugins/wolfram_alpha.py               18      0   100%
-----------------------------------------------------------------
TOTAL                                 602      9    99%
travis_fold:end:py-5506.cov.0

FAIL Required test coverage of 100% not reached. Total coverage: 98.50%
=============================== warnings summary ===============================
<undetermined location>
  Module already imported so cannot be rewritten: errbot.backends.test

tests/labhub_test.py::TestBot
  cannot collect test class 'TestBot' because it has a __init__ constructor

tests/spam_test.py::TestBot
  cannot collect test class 'TestBot' because it has a __init__ constructor

-- Docs: http://doc.pytest.org/en/latest/warnings.html
=============== 39 passed, 3 warnings, 1 error in 106.00 seconds ===============

Copy link
Member

@jayvdb jayvdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Mixin's __init__ needs to assert that CONFIG_TEMPLATE exists and is not empty.

It is quite common for mixin classes to create an empty class variable for things like this, so the Mixin can document the extra class variables it relies on.

@jayvdb
Copy link
Member

jayvdb commented Aug 5, 2018

I would like to see separate commits included in this PR for all of the configuration upgrades which we need (except for LabHub):

Any others?

Only by putting them all in here together can we ensure that this is the last change needed to DefaultConfigMixin for your project.

@gitmate-bot
Copy link

Comment on 5f8068a, file plugins/ghetto.py, line 20.

Broken link - unable to connect to http://www.gizoogle.net/textilizer.php

Origin: InvalidLinkBear, Section: all.links.

@nvzard nvzard force-pushed the fix_mixin branch 3 times, most recently from c19c07f to e640c4c Compare August 10, 2018 10:24
@nvzard nvzard changed the title DefaultConfigMixin: Modify implementation [WIP] DefaultConfigMixin: Modify implementation Aug 11, 2018
@nvzard nvzard force-pushed the fix_mixin branch 2 times, most recently from 71fca61 to 8db9a2a Compare August 11, 2018 18:12
@gitmate-bot
Copy link

Comment on a32333d, file plugins/ban.py, line 32.

Broken link - unable to connect to https://api.gitter.im/v1/rooms

Origin: InvalidLinkBear, Section: all.links.

@gitmate-bot
Copy link

Comment on 8db9a2a, file tests/ghetto_test.py, line 13.

Broken link - unable to connect to http://www.gizoogle.net/textilizer.php

Origin: InvalidLinkBear, Section: all.links.

@gitmate-bot
Copy link

Comment on 079e7bd, file plugins/ban.py, line 66.

Broken link - unable to connect to https://api.gitter.im/v1/rooms

Origin: InvalidLinkBear, Section: all.links.

@nvzard nvzard changed the title [WIP] DefaultConfigMixin: Modify implementation DefaultConfigMixin: Modify implementation Aug 11, 2018
utils/mixin.py Outdated
if default_config and not hasattr(self, 'config'):
self.configure(default_config)
if not hasattr(self, 'CONFIG_TEMPLATE'): # pragma: no cover
self.log.error('CONFIG_TEMPLATE for plugin %s is missing.', self.name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect syntax!!

@@ -24,6 +26,9 @@ def test_answer(self):
self.assertIn('Please checkout the following links', self.pop_message())
self.push_message('!answer shell autocompletion')
self.assertIn('Please checkout the following links', self.pop_message())
self.assertCommand('!plugin config answer',
# Ignore InvalidLinkBear
'{\'ANSWER_END\': \'http://0.0.0.0:8000\'}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use self.answer_end_point , and dont # Ignore InvalidLinkBear

Store the default values in `CONFIG_TEMPLATE` and
then allow a subset of those config variables
overridden in the config.py's `DEFAULT_CONFIG`.

Closes coala#596
Replace the use of environment variables with
config variable.

Closes coala#383
Replace the use of environment variables with
config variable

Closes coala#381
@jayvdb
Copy link
Member

jayvdb commented Aug 12, 2018

ack 8e4d63e 4f2b470 faafb25

@jayvdb
Copy link
Member

jayvdb commented Aug 12, 2018

@gitmate-bot ff

@gitmate-bot
Copy link

Hey! I'm GitMate.io! This pull request is being fastforwarded automatically. Please DO NOT push while fastforward is in progress or your changes would be lost permanently ⚠️

@jayvdb
Copy link
Member

jayvdb commented Aug 12, 2018

@gitmate-bot ff

@gitmate-bot
Copy link

Hey! I'm GitMate.io! This pull request is being fastforwarded automatically. Please DO NOT push while fastforward is in progress or your changes would be lost permanently ⚠️

@gitmate-bot gitmate-bot merged commit faafb25 into coala:master Aug 12, 2018
@gitmate-bot
Copy link

Automated fastforward with GitMate.io was successful! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants