Small flake8 fixes for tests (#987)

This commit is contained in:
Brett Sun 2016-12-22 11:57:13 +01:00 committed by GitHub
parent 9319583ab4
commit 2882bee48e
8 changed files with 6 additions and 14 deletions

View File

@ -3,10 +3,6 @@ from unittest.mock import Mock
from multipipes import Pipe from multipipes import Pipe
import bigchaindb
from bigchaindb import Bigchain
from bigchaindb.backend import connect
@pytest.fixture @pytest.fixture
def mock_changefeed_data(): def mock_changefeed_data():
@ -26,6 +22,9 @@ def mock_changefeed_data():
@pytest.fixture @pytest.fixture
def mock_changefeed_connection(mock_changefeed_data): def mock_changefeed_connection(mock_changefeed_data):
import bigchaindb
from bigchaindb.backend import connect
connection = connect(**bigchaindb.config['database']) connection = connect(**bigchaindb.config['database'])
connection.run = Mock(return_value=mock_changefeed_data) connection.run = Mock(return_value=mock_changefeed_data)
return connection return connection

View File

@ -214,6 +214,7 @@ def test_run_configure_when_config_does_exist(monkeypatch,
mock_generate_key_pair, mock_generate_key_pair,
mock_bigchaindb_backup_config): mock_bigchaindb_backup_config):
value = {} value = {}
def mock_write_config(newconfig, filename=None): def mock_write_config(newconfig, filename=None):
value['return'] = newconfig value['return'] = newconfig

View File

@ -578,7 +578,6 @@ class TestTransactionValidation(object):
assert excinfo.value.args[0] == 'Only `CREATE` transactions can have null inputs' assert excinfo.value.args[0] == 'Only `CREATE` transactions can have null inputs'
def test_non_create_input_not_found(self, b, user_pk, signed_transfer_tx): def test_non_create_input_not_found(self, b, user_pk, signed_transfer_tx):
from bigchaindb.common.exceptions import TransactionDoesNotExist from bigchaindb.common.exceptions import TransactionDoesNotExist
from bigchaindb.common.transaction import TransactionLink from bigchaindb.common.transaction import TransactionLink
@ -729,7 +728,6 @@ class TestBlockValidation(object):
assert excinfo.value.args[0] == 'owner_before `a` does not own the input `{}`'.format(valid_input) assert excinfo.value.args[0] == 'owner_before `a` does not own the input `{}`'.format(valid_input)
def test_invalid_signature(self, b): def test_invalid_signature(self, b):
from bigchaindb.common.exceptions import InvalidSignature from bigchaindb.common.exceptions import InvalidSignature
from bigchaindb.common import crypto from bigchaindb.common import crypto
@ -744,7 +742,6 @@ class TestBlockValidation(object):
with pytest.raises(InvalidSignature): with pytest.raises(InvalidSignature):
b.validate_block(block) b.validate_block(block)
def test_invalid_node_pubkey(self, b): def test_invalid_node_pubkey(self, b):
from bigchaindb.common.exceptions import OperationError from bigchaindb.common.exceptions import OperationError
from bigchaindb.common import crypto from bigchaindb.common import crypto

View File

@ -130,7 +130,6 @@ def test_check_requeue_transaction(b, user_pk):
assert backlog_tx == tx1 assert backlog_tx == tx1
@patch.object(Pipeline, 'start') @patch.object(Pipeline, 'start')
def test_start(mock_start): def test_start(mock_start):
# TODO: `block.election` is just a wrapper around `block.create_pipeline`, # TODO: `block.election` is just a wrapper around `block.create_pipeline`,

View File

@ -1,4 +1,3 @@
import os
import random import random
from bigchaindb import Bigchain from bigchaindb import Bigchain
from bigchaindb.pipelines import stale from bigchaindb.pipelines import stale

View File

@ -1,5 +1,3 @@
from rethinkdb.ast import RqlQuery
import pytest import pytest

View File

@ -20,4 +20,3 @@ def test_processes_start(mock_vote, mock_block, mock_election, mock_stale,
mock_election.assert_called_with() mock_election.assert_called_with()
mock_stale.assert_called_with() mock_stale.assert_called_with()
mock_process.assert_called_with() mock_process.assert_called_with()