From 750304b575f6543a54361cea3033a57a3cd94429 Mon Sep 17 00:00:00 2001 From: tymlez Date: Thu, 26 Jan 2017 18:36:38 +0000 Subject: [PATCH] resolve travis errors --- bigchaindb/config_utils.py | 3 ++- bigchaindb/pipelines/vote.py | 6 +++--- tests/test_config_utils.py | 2 ++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bigchaindb/config_utils.py b/bigchaindb/config_utils.py index 2b0fede8..8b8208ac 100644 --- a/bigchaindb/config_utils.py +++ b/bigchaindb/config_utils.py @@ -245,6 +245,7 @@ def autoconfigure(filename=None, config=None, force=False): set_config(newconfig) # sets bigchaindb.config + @lru_cache() def load_consensus_plugin(name=None): """Find and load the chosen consensus plugin. @@ -257,7 +258,7 @@ def load_consensus_plugin(name=None): an uninstantiated subclass of ``bigchaindb.consensus.AbstractConsensusRules`` """ if not name: - return BaseConsensusRules; + return BaseConsensusRules # TODO: This will return the first plugin with group `bigchaindb.consensus` # and name `name` in the active WorkingSet. diff --git a/bigchaindb/pipelines/vote.py b/bigchaindb/pipelines/vote.py index 5d1555fe..75187efa 100644 --- a/bigchaindb/pipelines/vote.py +++ b/bigchaindb/pipelines/vote.py @@ -32,17 +32,17 @@ class Vote: # Since cannot share a connection to RethinkDB using multiprocessing, # we need to create a temporary instance of BigchainDB that we use # only to query RethinkDB - #self.consensus = BaseConsensusRules consensusPlugin = bigchaindb.config.get('consensus_plugin') if consensusPlugin: - self.consensus = config_utils.load_consensus_plugin(consensusPlugin) + self.consensus = config_utils.load_consensus_plugin(consensusPlugin) else: - self.consensus = BaseConsensusRules + self.consensus = BaseConsensusRules # This is the Bigchain instance that will be "shared" (aka: copied) # by all the subprocesses + self.bigchain = Bigchain() self.last_voted_id = Bigchain().get_last_voted_block().id diff --git a/tests/test_config_utils.py b/tests/test_config_utils.py index dcf83c02..25290ee9 100644 --- a/tests/test_config_utils.py +++ b/tests/test_config_utils.py @@ -39,6 +39,7 @@ def test_bigchain_instance_raises_when_not_configured(monkeypatch): with pytest.raises(exceptions.KeypairNotFoundException): bigchaindb.Bigchain() + def test_load_consensus_plugin_loads_default_rules_without_name(): from bigchaindb import config_utils from bigchaindb.consensus import BaseConsensusRules @@ -68,6 +69,7 @@ def test_load_consensus_plugin_raises_with_invalid_subclass(monkeypatch): # "miss" the cache using a name that has not been used previously config_utils.load_consensus_plugin(str(time.time())) + def test_map_leafs_iterator(): from bigchaindb import config_utils