예제 #1
0
def test_throw_error_runtime_error():
    with open('%s/config.ini-throw-runtime-error' % gettempdir(), 'w') as f:
        f.write("""
[Plugins]
plugins=RuntimeError
        """)
    if hasattr(load_config, 'config'):
        del load_config.config

    plugins = Plugins()
    plugins.load()
    status_after = plugins.run_all_after('', '', '', '')
    status_batch = plugins.run_batch()
    status_before = plugins.run_all_before('', '')

    if hasattr(load_config, 'config'):
        del load_config.config

    assert status_after == True, status_after
    assert status_batch == True, status_batch
    assert status_before == True, status_before
예제 #2
0
def test_throw_error_one_of_many():
    with open('%s/config.ini-throw-error-one-of-many' % gettempdir(),
              'w') as f:
        f.write("""
[Plugins]
plugins=Dummy,ThrowError
        """)
    if hasattr(load_config, 'config'):
        del load_config.config

    plugins = Plugins()
    plugins.load()
    status_after = plugins.run_all_after('', '', '', '')
    status_batch = plugins.run_batch()
    status_before = plugins.run_all_before('', '')

    if hasattr(load_config, 'config'):
        del load_config.config

    assert status_after == False, status_after
    assert status_batch == False, status_batch
    assert status_before == False, status_before
예제 #3
0
def _batch(debug):
    """Run batch() for all plugins.
    """
    constants.debug = debug
    plugins = Plugins()
    plugins.run_batch()