Ejemplo n.º 1
0
def tconf(tconf, request):
    global PLUGIN_LEDGER_IDS, PLUGIN_CLIENT_REQUEST_FIELDS

    orig_plugin_root = deepcopy(tconf.PLUGIN_ROOT)
    orig_enabled_plugins = deepcopy(tconf.ENABLED_PLUGINS)
    orig_plugin_ledger_ids = deepcopy(PLUGIN_LEDGER_IDS)
    orig_plugin_client_req_fields = deepcopy(PLUGIN_CLIENT_REQUEST_FIELDS)

    update_module_vars(
        'plenum.config', **{
            'PLUGIN_ROOT': 'plenum.test.plugin',
            'ENABLED_PLUGINS': [
                'demo_plugin',
            ],
        })
    PLUGIN_LEDGER_IDS = set()
    PLUGIN_CLIENT_REQUEST_FIELDS = {}
    setup_plugins()
    do_plugin_initialisation_for_tests()

    def reset():
        global PLUGIN_LEDGER_IDS, PLUGIN_CLIENT_REQUEST_FIELDS
        update_module_vars(
            'plenum.config', **{
                'PLUGIN_ROOT': orig_plugin_root,
                'ENABLED_PLUGINS': orig_enabled_plugins,
            })
        PLUGIN_LEDGER_IDS = orig_plugin_ledger_ids
        PLUGIN_CLIENT_REQUEST_FIELDS = orig_plugin_client_req_fields
        setup_plugins()

    request.addfinalizer(reset)
    return tconf
Ejemplo n.º 2
0
def tconf(tconf, request):
    global PLUGIN_LEDGER_IDS, PLUGIN_CLIENT_REQUEST_FIELDS

    orig_plugin_root = deepcopy(tconf.PLUGIN_ROOT)
    orig_enabled_plugins = deepcopy(tconf.ENABLED_PLUGINS)
    orig_plugin_ledger_ids = deepcopy(PLUGIN_LEDGER_IDS)
    orig_plugin_client_req_fields = deepcopy(PLUGIN_CLIENT_REQUEST_FIELDS)

    update_module_vars('plenum.config',
                       **{
                           'PLUGIN_ROOT': 'plenum.test.plugin',
                           'ENABLED_PLUGINS': ['demo_plugin', ],
                       })
    PLUGIN_LEDGER_IDS = set()
    PLUGIN_CLIENT_REQUEST_FIELDS = {}
    setup_plugins()
    do_plugin_initialisation_for_tests()

    def reset():
        global PLUGIN_LEDGER_IDS, PLUGIN_CLIENT_REQUEST_FIELDS
        update_module_vars('plenum.config',
                           **{
                               'PLUGIN_ROOT': orig_plugin_root,
                               'ENABLED_PLUGINS': orig_enabled_plugins,
                           })
        PLUGIN_LEDGER_IDS = orig_plugin_ledger_ids
        PLUGIN_CLIENT_REQUEST_FIELDS = orig_plugin_client_req_fields
        setup_plugins()

    request.addfinalizer(reset)
    return tconf
Ejemplo n.º 3
0
 def reset():
     global PLUGIN_LEDGER_IDS, PLUGIN_CLIENT_REQUEST_FIELDS
     update_module_vars(
         'plenum.config', **{
             'PLUGIN_ROOT': orig_plugin_root,
             'ENABLED_PLUGINS': orig_enabled_plugins,
         })
     PLUGIN_LEDGER_IDS = orig_plugin_ledger_ids
     PLUGIN_CLIENT_REQUEST_FIELDS = orig_plugin_client_req_fields
     setup_plugins()
Ejemplo n.º 4
0
 def reset():
     global PLUGIN_LEDGER_IDS, PLUGIN_CLIENT_REQUEST_FIELDS
     update_module_vars('plenum.config',
                        **{
                            'PLUGIN_ROOT': orig_plugin_root,
                            'ENABLED_PLUGINS': orig_enabled_plugins,
                        })
     PLUGIN_LEDGER_IDS = orig_plugin_ledger_ids
     PLUGIN_CLIENT_REQUEST_FIELDS = orig_plugin_client_req_fields
     setup_plugins()