diff --git a/pytest.ini b/pytest.ini index 006bc2bc..625c3e09 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,5 @@ [pytest] testpaths = tests/ norecursedirs = .* *.egg *.egg-info env* devenv* docs -addopts = -m tendermint +addopts = -m "not abci" looponfailroots = bigchaindb tests diff --git a/tests/assets/test_digital_assets.py b/tests/assets/test_digital_assets.py index 029db261..9af59245 100644 --- a/tests/assets/test_digital_assets.py +++ b/tests/assets/test_digital_assets.py @@ -6,9 +6,6 @@ import pytest import random -pytestmark = pytest.mark.tendermint - - def test_asset_transfer(b, signed_create_tx, user_pk, user_sk): from bigchaindb.models import Transaction diff --git a/tests/assets/test_divisible_assets.py b/tests/assets/test_divisible_assets.py index a4d1241a..276495cd 100644 --- a/tests/assets/test_divisible_assets.py +++ b/tests/assets/test_divisible_assets.py @@ -8,9 +8,6 @@ import random from bigchaindb.common.exceptions import DoubleSpend -pytestmark = pytest.mark.tendermint - - # CREATE divisible asset # Single input # Single owners_before diff --git a/tests/backend/localmongodb/test_connection.py b/tests/backend/localmongodb/test_connection.py index 9bb3d9aa..eeb0adb8 100644 --- a/tests/backend/localmongodb/test_connection.py +++ b/tests/backend/localmongodb/test_connection.py @@ -9,7 +9,7 @@ import pymongo from pymongo import MongoClient -pytestmark = [pytest.mark.bdb, pytest.mark.tendermint] +pytestmark = pytest.mark.bdb @pytest.fixture diff --git a/tests/backend/localmongodb/test_queries.py b/tests/backend/localmongodb/test_queries.py index 2262d723..dd8621d4 100644 --- a/tests/backend/localmongodb/test_queries.py +++ b/tests/backend/localmongodb/test_queries.py @@ -10,7 +10,7 @@ import pymongo from bigchaindb.backend import connect, query -pytestmark = [pytest.mark.tendermint, pytest.mark.bdb] +pytestmark = pytest.mark.bdb def test_get_txids_filtered(signed_create_tx, signed_transfer_tx): diff --git a/tests/backend/localmongodb/test_schema.py b/tests/backend/localmongodb/test_schema.py index aeadbe05..0d49c4ec 100644 --- a/tests/backend/localmongodb/test_schema.py +++ b/tests/backend/localmongodb/test_schema.py @@ -5,9 +5,6 @@ import pytest -pytestmark = [pytest.mark.bdb, pytest.mark.tendermint] - - def test_init_creates_db_tables_and_indexes(): import bigchaindb from bigchaindb import backend diff --git a/tests/backend/test_connection.py b/tests/backend/test_connection.py index 71d42458..52b0e4b0 100644 --- a/tests/backend/test_connection.py +++ b/tests/backend/test_connection.py @@ -5,9 +5,6 @@ import pytest -pytestmark = pytest.mark.tendermint - - def test_get_connection_raises_a_configuration_error(monkeypatch): from bigchaindb.common.exceptions import ConfigurationError from bigchaindb.backend import connect diff --git a/tests/backend/test_generics.py b/tests/backend/test_generics.py index 98b56bbf..6ddd7331 100644 --- a/tests/backend/test_generics.py +++ b/tests/backend/test_generics.py @@ -2,14 +2,9 @@ # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 -import pytest - from pytest import mark, raises -pytestmark = pytest.mark.tendermint - - @mark.parametrize('schema_func_name,args_qty', ( ('create_database', 1), ('create_tables', 1), diff --git a/tests/backend/test_utils.py b/tests/backend/test_utils.py index 61c123ac..16e390af 100644 --- a/tests/backend/test_utils.py +++ b/tests/backend/test_utils.py @@ -8,9 +8,6 @@ from types import ModuleType import pytest -pytestmark = pytest.mark.tendermint - - @pytest.fixture def mock_module(): return ModuleType('mock_module') diff --git a/tests/commands/conftest.py b/tests/commands/conftest.py index ce09ff24..d4591720 100644 --- a/tests/commands/conftest.py +++ b/tests/commands/conftest.py @@ -27,8 +27,8 @@ def mock_db_init_with_existing_db(monkeypatch): @pytest.fixture def mock_processes_start(monkeypatch): - from bigchaindb.utils import Process - monkeypatch.setattr(Process, 'run', lambda *args: None) + from bigchaindb import start + monkeypatch.setattr(start, 'start', lambda *args: None) @pytest.fixture @@ -56,7 +56,7 @@ def run_start_args(request): @pytest.fixture def mocked_setup_logging(mocker): return mocker.patch( - 'bigchaindb.commands.utils.setup_logging', + 'bigchaindb.log.setup_logging', autospec=True, spec_set=True, ) diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index 5a5d2deb..6ed54425 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -14,7 +14,6 @@ from bigchaindb import ValidatorElection from tests.conftest import node_keys -@pytest.mark.tendermint def test_make_sure_we_dont_remove_any_command(): # thanks to: http://stackoverflow.com/a/18161115/597097 from bigchaindb.commands.bigchaindb import create_parser @@ -33,7 +32,6 @@ def test_make_sure_we_dont_remove_any_command(): assert parser.parse_args(['upsert-validator', 'show', 'ELECTION_ID']).command -@pytest.mark.tendermint @patch('bigchaindb.commands.utils.start') def test_main_entrypoint(mock_start): from bigchaindb.commands.bigchaindb import main @@ -42,22 +40,21 @@ def test_main_entrypoint(mock_start): assert mock_start.called -def test_bigchain_run_start(mock_run_configure, - mock_processes_start, - mock_db_init_with_existing_db, - mocked_setup_logging): - from bigchaindb import config +@patch('bigchaindb.log.setup_logging') +@patch('bigchaindb.commands.bigchaindb._run_init') +@patch('bigchaindb.config_utils.autoconfigure') +def test_bigchain_run_start(mock_setup_logging, mock_run_init, + mock_autoconfigure, mock_processes_start): from bigchaindb.commands.bigchaindb import run_start args = Namespace(config=None, yes=True, skip_initialize_database=False) run_start(args) - mocked_setup_logging.assert_called_once_with(user_log_config=config['log']) + assert mock_setup_logging.called # TODO Please beware, that if debugging, the "-s" switch for pytest will # interfere with capsys. # See related issue: https://github.com/pytest-dev/pytest/issues/128 -@pytest.mark.tendermint @pytest.mark.usefixtures('ignore_local_config_file') def test_bigchain_show_config(capsys): from bigchaindb.commands.bigchaindb import run_show_config @@ -78,7 +75,6 @@ def test_bigchain_show_config(capsys): assert output_config == config -@pytest.mark.tendermint def test_bigchain_run_init_when_db_exists(mocker, capsys): from bigchaindb.commands.bigchaindb import run_init from bigchaindb.common.exceptions import DatabaseAlreadyExists @@ -98,7 +94,6 @@ def test_bigchain_run_init_when_db_exists(mocker, capsys): ) -@pytest.mark.tendermint def test__run_init(mocker): from bigchaindb.commands.bigchaindb import _run_init bigchain_mock = mocker.patch( @@ -114,7 +109,6 @@ def test__run_init(mocker): connection=bigchain_mock.return_value.connection) -@pytest.mark.tendermint @patch('bigchaindb.backend.schema.drop_database') def test_drop_db_when_assumed_yes(mock_db_drop): from bigchaindb.commands.bigchaindb import run_drop @@ -124,7 +118,6 @@ def test_drop_db_when_assumed_yes(mock_db_drop): assert mock_db_drop.called -@pytest.mark.tendermint @patch('bigchaindb.backend.schema.drop_database') def test_drop_db_when_interactive_yes(mock_db_drop, monkeypatch): from bigchaindb.commands.bigchaindb import run_drop @@ -136,7 +129,6 @@ def test_drop_db_when_interactive_yes(mock_db_drop, monkeypatch): assert mock_db_drop.called -@pytest.mark.tendermint @patch('bigchaindb.backend.schema.drop_database') def test_drop_db_when_db_does_not_exist(mock_db_drop, capsys): from bigchaindb import config @@ -151,7 +143,6 @@ def test_drop_db_when_db_does_not_exist(mock_db_drop, capsys): name=config['database']['name']) -@pytest.mark.tendermint @patch('bigchaindb.backend.schema.drop_database') def test_drop_db_does_not_drop_when_interactive_no(mock_db_drop, monkeypatch): from bigchaindb.commands.bigchaindb import run_drop @@ -166,7 +157,6 @@ def test_drop_db_does_not_drop_when_interactive_no(mock_db_drop, monkeypatch): # TODO Beware if you are putting breakpoints in there, and using the '-s' # switch with pytest. It will just hang. Seems related to the monkeypatching of # input_on_stderr. -@pytest.mark.tendermint def test_run_configure_when_config_does_not_exist(monkeypatch, mock_write_config, mock_generate_key_pair, @@ -179,7 +169,6 @@ def test_run_configure_when_config_does_not_exist(monkeypatch, assert return_value is None -@pytest.mark.tendermint def test_run_configure_when_config_does_exist(monkeypatch, mock_write_config, mock_generate_key_pair, @@ -201,7 +190,6 @@ def test_run_configure_when_config_does_exist(monkeypatch, @pytest.mark.skip -@pytest.mark.tendermint @pytest.mark.parametrize('backend', ( 'localmongodb', )) @@ -235,10 +223,9 @@ def test_run_start_when_db_already_exists(mocker, monkeypatch, run_start_args, mocked_setup_logging): - from bigchaindb import config from bigchaindb.commands.bigchaindb import run_start from bigchaindb.common.exceptions import DatabaseAlreadyExists - mocked_start = mocker.patch('bigchaindb.processes.start') + mocked_start = mocker.patch('bigchaindb.start.start') def mock_run_init(): raise DatabaseAlreadyExists() @@ -246,11 +233,9 @@ def test_run_start_when_db_already_exists(mocker, monkeypatch.setattr( 'bigchaindb.commands.bigchaindb._run_init', mock_run_init) run_start(run_start_args) - mocked_setup_logging.assert_called_once_with(user_log_config=config['log']) assert mocked_start.called -@pytest.mark.tendermint @patch('bigchaindb.commands.utils.start') def test_calling_main(start_mock, monkeypatch): from bigchaindb.commands.bigchaindb import main @@ -295,7 +280,6 @@ def test_recover_db_on_start(mock_run_recover, assert mock_start.called -@pytest.mark.tendermint @pytest.mark.bdb def test_run_recover(b, alice, bob): from bigchaindb.commands.bigchaindb import run_recover @@ -364,7 +348,6 @@ def test_upsert_validator_new_with_tendermint(b, priv_validator_path, user_sk, v assert b.get_transaction(election_id) -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_new_without_tendermint(caplog, b, priv_validator_path, user_sk): from bigchaindb.commands.bigchaindb import run_upsert_validator_new @@ -389,7 +372,6 @@ def test_upsert_validator_new_without_tendermint(caplog, b, priv_validator_path, assert b.get_transaction(election_id) -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_new_invalid_election(caplog, b, priv_validator_path, user_sk): from bigchaindb.commands.bigchaindb import run_upsert_validator_new @@ -406,7 +388,6 @@ def test_upsert_validator_new_invalid_election(caplog, b, priv_validator_path, u assert caplog.records[0].msg.__class__ == FileNotFoundError -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_new_election_invalid_power(caplog, b, priv_validator_path, user_sk): from bigchaindb.commands.bigchaindb import run_upsert_validator_new @@ -456,7 +437,6 @@ def test_upsert_validator_approve_with_tendermint(b, priv_validator_path, user_s @pytest.mark.bdb -@pytest.mark.tendermint def test_upsert_validator_approve_without_tendermint(caplog, b, priv_validator_path, new_validator, node_key): from bigchaindb.commands.bigchaindb import run_upsert_validator_approve from argparse import Namespace @@ -476,7 +456,6 @@ def test_upsert_validator_approve_without_tendermint(caplog, b, priv_validator_p assert b.get_transaction(approval_id) -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_approve_failure(caplog, b, priv_validator_path, new_validator, node_key): from bigchaindb.commands.bigchaindb import run_upsert_validator_approve @@ -501,7 +480,6 @@ def test_upsert_validator_approve_failure(caplog, b, priv_validator_path, new_va assert caplog.records[0].msg == 'Failed to commit vote' -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_approve_called_with_bad_key(caplog, b, bad_validator_path, new_validator, node_key): from bigchaindb.commands.bigchaindb import run_upsert_validator_approve diff --git a/tests/commands/test_utils.py b/tests/commands/test_utils.py index 11ff41a8..eeac67fc 100644 --- a/tests/commands/test_utils.py +++ b/tests/commands/test_utils.py @@ -10,8 +10,6 @@ import pytest from unittest.mock import patch -pytestmark = pytest.mark.tendermint - @pytest.fixture def reset_bigchaindb_config(monkeypatch): diff --git a/tests/common/test_memoize.py b/tests/common/test_memoize.py index 3cc7f62b..20c84f31 100644 --- a/tests/common/test_memoize.py +++ b/tests/common/test_memoize.py @@ -10,7 +10,7 @@ from bigchaindb.common.crypto import generate_key_pair from bigchaindb.common.memoize import to_dict, from_dict -pytestmark = [pytest.mark.tendermint, pytest.mark.bdb] +pytestmark = pytest.mark.bdb def test_memoize_to_dict(b): diff --git a/tests/common/test_schema.py b/tests/common/test_schema.py index 93fe2e3c..0ca1be68 100644 --- a/tests/common/test_schema.py +++ b/tests/common/test_schema.py @@ -8,8 +8,6 @@ properties related to validation. from unittest.mock import patch -import pytest - from hypothesis import given from hypothesis_regex import regex from pytest import raises @@ -25,9 +23,6 @@ UNSUPPORTED_CRYPTOCONDITION_TYPES = ( 'preimage-sha-256', 'prefix-sha-256', 'rsa-sha-256') -pytestmark = pytest.mark.tendermint - - ################################################################################ # Test of schema utils diff --git a/tests/common/test_transaction.py b/tests/common/test_transaction.py index fc6444dd..8e5a2b6c 100644 --- a/tests/common/test_transaction.py +++ b/tests/common/test_transaction.py @@ -13,7 +13,7 @@ from cryptoconditions import Ed25519Sha256 from pytest import mark, raises from sha3 import sha3_256 -pytestmark = [mark.tendermint, mark.bdb] +pytestmark = mark.bdb def test_input_serialization(ffill_uri, user_pub): diff --git a/tests/db/test_bigchain_api.py b/tests/db/test_bigchain_api.py index 1ec1904c..1af41e37 100644 --- a/tests/db/test_bigchain_api.py +++ b/tests/db/test_bigchain_api.py @@ -12,7 +12,6 @@ pytestmark = pytest.mark.bdb class TestBigchainApi(object): - @pytest.mark.tendermint def test_get_spent_with_double_spend_detected(self, b, alice): from bigchaindb.models import Transaction from bigchaindb.common.exceptions import DoubleSpend @@ -43,7 +42,6 @@ class TestBigchainApi(object): with pytest.raises(CriticalDoubleSpend): b.get_spent(tx.id, 0) - @pytest.mark.tendermint def test_double_inclusion(self, b, alice): from bigchaindb.models import Transaction from bigchaindb.backend.exceptions import OperationError @@ -56,7 +54,6 @@ class TestBigchainApi(object): with pytest.raises(OperationError): b.store_bulk_transactions([tx]) - @pytest.mark.tendermint def test_text_search(self, b, alice): from bigchaindb.models import Transaction @@ -81,7 +78,6 @@ class TestBigchainApi(object): assert len(assets) == 3 @pytest.mark.usefixtures('inputs') - @pytest.mark.tendermint def test_non_create_input_not_found(self, b, user_pk): from cryptoconditions import Ed25519Sha256 from bigchaindb.common.exceptions import InputDoesNotExist @@ -97,7 +93,6 @@ class TestBigchainApi(object): with pytest.raises(InputDoesNotExist): tx.validate(b) - @pytest.mark.tendermint def test_write_transaction(self, b, user_sk, user_pk, alice, create_tx): from bigchaindb.models import Transaction @@ -120,7 +115,6 @@ class TestBigchainApi(object): class TestTransactionValidation(object): - @pytest.mark.tendermint def test_non_create_input_not_found(self, b, signed_transfer_tx): from bigchaindb.common.exceptions import InputDoesNotExist from bigchaindb.common.transaction import TransactionLink @@ -129,7 +123,6 @@ class TestTransactionValidation(object): with pytest.raises(InputDoesNotExist): b.validate_transaction(signed_transfer_tx) - @pytest.mark.tendermint @pytest.mark.usefixtures('inputs') def test_non_create_valid_input_wrong_owner(self, b, user_pk): from bigchaindb.common.crypto import generate_key_pair @@ -147,7 +140,6 @@ class TestTransactionValidation(object): with pytest.raises(InvalidSignature): b.validate_transaction(tx) - @pytest.mark.tendermint @pytest.mark.usefixtures('inputs') def test_non_create_double_spend(self, b, signed_create_tx, signed_transfer_tx, double_spend_tx): @@ -161,7 +153,6 @@ class TestTransactionValidation(object): class TestMultipleInputs(object): - @pytest.mark.tendermint def test_transfer_single_owner_single_input(self, b, inputs, user_pk, user_sk): from bigchaindb.common import crypto @@ -181,7 +172,6 @@ class TestMultipleInputs(object): assert len(tx.inputs) == 1 assert len(tx.outputs) == 1 - @pytest.mark.tendermint def test_single_owner_before_multiple_owners_after_single_input(self, b, user_sk, user_pk, @@ -203,7 +193,6 @@ class TestMultipleInputs(object): assert len(tx.inputs) == 1 assert len(tx.outputs) == 1 - @pytest.mark.tendermint @pytest.mark.usefixtures('inputs') def test_multiple_owners_before_single_owner_after_single_input(self, b, user_sk, @@ -232,7 +221,6 @@ class TestMultipleInputs(object): assert len(transfer_tx.inputs) == 1 assert len(transfer_tx.outputs) == 1 - @pytest.mark.tendermint @pytest.mark.usefixtures('inputs') def test_multiple_owners_before_multiple_owners_after_single_input(self, b, user_sk, @@ -262,7 +250,6 @@ class TestMultipleInputs(object): assert len(tx.inputs) == 1 assert len(tx.outputs) == 1 - @pytest.mark.tendermint def test_get_owned_ids_single_tx_single_output(self, b, user_sk, user_pk, alice): from bigchaindb.common import crypto from bigchaindb.common.transaction import TransactionLink @@ -290,7 +277,6 @@ class TestMultipleInputs(object): assert owned_inputs_user1 == [TransactionLink(tx.id, 0)] assert owned_inputs_user2 == [TransactionLink(tx_transfer.id, 0)] - @pytest.mark.tendermint def test_get_owned_ids_single_tx_multiple_outputs(self, b, user_sk, user_pk, alice): from bigchaindb.common import crypto @@ -326,7 +312,6 @@ class TestMultipleInputs(object): assert owned_inputs_user2 == [TransactionLink(tx_transfer.id, 0), TransactionLink(tx_transfer.id, 1)] - @pytest.mark.tendermint def test_get_owned_ids_multiple_owners(self, b, user_sk, user_pk, alice): from bigchaindb.common import crypto from bigchaindb.common.transaction import TransactionLink @@ -359,7 +344,6 @@ class TestMultipleInputs(object): assert owned_inputs_user1 == owned_inputs_user2 assert not spent_user1 - @pytest.mark.tendermint def test_get_spent_single_tx_single_output(self, b, user_sk, user_pk, alice): from bigchaindb.common import crypto from bigchaindb.models import Transaction @@ -386,7 +370,6 @@ class TestMultipleInputs(object): spent_inputs_user1 = b.get_spent(input_txid, 0) assert spent_inputs_user1 == tx - @pytest.mark.tendermint def test_get_spent_single_tx_multiple_outputs(self, b, user_sk, user_pk, alice): from bigchaindb.common import crypto from bigchaindb.models import Transaction @@ -424,7 +407,6 @@ class TestMultipleInputs(object): # spendable by BigchainDB assert b.get_spent(tx_create.to_inputs()[2].fulfills.txid, 2) is None - @pytest.mark.tendermint def test_get_spent_multiple_owners(self, b, user_sk, user_pk, alice): from bigchaindb.common import crypto from bigchaindb.models import Transaction @@ -461,7 +443,6 @@ class TestMultipleInputs(object): assert b.get_spent(unspent.id, 0) is None -@pytest.mark.tendermint def test_get_outputs_filtered_only_unspent(): from bigchaindb.common.transaction import TransactionLink from bigchaindb.lib import BigchainDB @@ -478,7 +459,6 @@ def test_get_outputs_filtered_only_unspent(): assert out == [TransactionLink('b', 2)] -@pytest.mark.tendermint def test_get_outputs_filtered_only_spent(): from bigchaindb.common.transaction import TransactionLink from bigchaindb.lib import BigchainDB @@ -494,7 +474,6 @@ def test_get_outputs_filtered_only_spent(): assert out == [TransactionLink('b', 2)] -@pytest.mark.tendermint @patch('bigchaindb.fastquery.FastQuery.filter_unspent_outputs') @patch('bigchaindb.fastquery.FastQuery.filter_spent_outputs') def test_get_outputs_filtered(filter_spent, filter_unspent): @@ -512,7 +491,6 @@ def test_get_outputs_filtered(filter_spent, filter_unspent): assert out == get_outputs.return_value -@pytest.mark.tendermint def test_cant_spend_same_input_twice_in_tx(b, alice): """Recreate duplicated fulfillments bug https://github.com/bigchaindb/bigchaindb/issues/1099 @@ -536,7 +514,6 @@ def test_cant_spend_same_input_twice_in_tx(b, alice): tx_transfer_signed.validate(b) -@pytest.mark.tendermint def test_transaction_unicode(b, alice): import copy from bigchaindb.common.utils import serialize diff --git a/tests/tendermint/test_core.py b/tests/tendermint/test_core.py index c98ee1ea..b59cc0c6 100644 --- a/tests/tendermint/test_core.py +++ b/tests/tendermint/test_core.py @@ -28,7 +28,7 @@ from bigchaindb.upsert_validator.validator_utils import new_validator_set from bigchaindb.tendermint_utils import public_key_to_base64 -pytestmark = [pytest.mark.tendermint, pytest.mark.bdb] +pytestmark = pytest.mark.bdb def encode_tx_to_bytes(transaction): diff --git a/tests/tendermint/test_event_stream.py b/tests/tendermint/test_event_stream.py index 365ea1e0..f23eeaba 100644 --- a/tests/tendermint/test_event_stream.py +++ b/tests/tendermint/test_event_stream.py @@ -10,7 +10,6 @@ from aiohttp import ClientSession import pytest -@pytest.mark.tendermint def test_process_event_new_block(): from bigchaindb.event_stream import process_event @@ -48,7 +47,6 @@ def test_process_event_new_block(): assert isinstance(block.data['height'], int) -@pytest.mark.tendermint def test_process_event_empty_block(): from bigchaindb.event_stream import process_event @@ -69,7 +67,6 @@ def test_process_event_empty_block(): assert event_queue.empty() -@pytest.mark.tendermint def test_process_unknown_event(): from bigchaindb.event_stream import process_event diff --git a/tests/tendermint/test_fastquery.py b/tests/tendermint/test_fastquery.py index 20eb1889..bf93850f 100644 --- a/tests/tendermint/test_fastquery.py +++ b/tests/tendermint/test_fastquery.py @@ -8,7 +8,7 @@ from bigchaindb.common.transaction import TransactionLink from bigchaindb.models import Transaction -pytestmark = [pytest.mark.bdb, pytest.mark.tendermint] +pytestmark = pytest.mark.bdb @pytest.fixture diff --git a/tests/tendermint/test_integration.py b/tests/tendermint/test_integration.py index e91c2be4..490da16b 100644 --- a/tests/tendermint/test_integration.py +++ b/tests/tendermint/test_integration.py @@ -14,7 +14,6 @@ from abci.encoding import read_messages from io import BytesIO -@pytest.mark.tendermint @pytest.mark.bdb def test_app(b, init_chain_request): from bigchaindb import App diff --git a/tests/tendermint/test_lib.py b/tests/tendermint/test_lib.py index 3ea91329..6b384b33 100644 --- a/tests/tendermint/test_lib.py +++ b/tests/tendermint/test_lib.py @@ -18,9 +18,6 @@ from bigchaindb import backend from bigchaindb.lib import Block -pytestmark = pytest.mark.tendermint - - @pytest.mark.bdb def test_asset_is_separated_from_transaciton(b): import copy diff --git a/tests/tendermint/test_utils.py b/tests/tendermint/test_utils.py index 46b36525..39d0b44e 100644 --- a/tests/tendermint/test_utils.py +++ b/tests/tendermint/test_utils.py @@ -10,11 +10,6 @@ try: except ImportError: from sha3 import sha3_256 -import pytest - - -pytestmark = pytest.mark.tendermint - def test_encode_decode_transaction(b): from bigchaindb.tendermint_utils import (encode_transaction, diff --git a/tests/test_config_utils.py b/tests/test_config_utils.py index 35f0e486..72dc4e29 100644 --- a/tests/test_config_utils.py +++ b/tests/test_config_utils.py @@ -13,9 +13,6 @@ import bigchaindb ORIGINAL_CONFIG = copy.deepcopy(bigchaindb._config) -pytestmark = pytest.mark.tendermint - - @pytest.fixture(scope='function', autouse=True) def clean_config(monkeypatch, request): original_config = copy.deepcopy(ORIGINAL_CONFIG) diff --git a/tests/test_core.py b/tests/test_core.py index 03701267..72e5bc1d 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4,8 +4,6 @@ import pytest -pytestmark = pytest.mark.tendermint - @pytest.fixture def config(request, monkeypatch): diff --git a/tests/test_events.py b/tests/test_events.py index 77e9a0f5..ab088b99 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -3,7 +3,6 @@ # Code is Apache-2.0 and docs are CC-BY-4.0 import pytest -pytestmark = pytest.mark.tendermint def test_event_handler(): diff --git a/tests/test_txlist.py b/tests/test_txlist.py index d2192632..8566f73d 100644 --- a/tests/test_txlist.py +++ b/tests/test_txlist.py @@ -8,8 +8,6 @@ This test module defines it's own fixture which is used by all the tests. """ import pytest -pytestmark = pytest.mark.tendermint - @pytest.fixture def txlist(b, user_pk, user2_pk, user_sk, user2_sk): diff --git a/tests/test_utils.py b/tests/test_utils.py index 31549be4..46b01bf7 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -7,8 +7,6 @@ from unittest.mock import patch, call import pytest -pytestmark = pytest.mark.tendermint - @pytest.fixture def mock_queue(monkeypatch): diff --git a/tests/upsert_validator/test_validator_election.py b/tests/upsert_validator/test_validator_election.py index 4c3849e4..bad475a3 100644 --- a/tests/upsert_validator/test_validator_election.py +++ b/tests/upsert_validator/test_validator_election.py @@ -13,7 +13,7 @@ from bigchaindb.common.exceptions import (DuplicateTransaction, MultipleInputsError, InvalidPowerChange) -pytestmark = [pytest.mark.tendermint, pytest.mark.bdb] +pytestmark = pytest.mark.bdb def test_upsert_validator_valid_election(b_mock, new_validator, node_key): diff --git a/tests/upsert_validator/test_validator_election_vote.py b/tests/upsert_validator/test_validator_election_vote.py index 4504977a..c395bbc1 100644 --- a/tests/upsert_validator/test_validator_election_vote.py +++ b/tests/upsert_validator/test_validator_election_vote.py @@ -15,7 +15,6 @@ from tests.utils import generate_block pytestmark = [pytest.mark.execute] -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_valid_election_vote(b_mock, valid_election, ed25519_node_keys): b_mock.store_bulk_transactions([valid_election]) @@ -34,7 +33,6 @@ def test_upsert_validator_valid_election_vote(b_mock, valid_election, ed25519_no assert vote.validate(b_mock) -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_valid_non_election_vote(b_mock, valid_election, ed25519_node_keys): b_mock.store_bulk_transactions([valid_election]) @@ -54,7 +52,6 @@ def test_upsert_validator_valid_non_election_vote(b_mock, valid_election, ed2551 .sign([key0.private_key]) -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_delegate_election_vote(b_mock, valid_election, ed25519_node_keys): alice = generate_key_pair() @@ -91,7 +88,6 @@ def test_upsert_validator_delegate_election_vote(b_mock, valid_election, ed25519 assert key0_casted_vote.validate(b_mock) -@pytest.mark.tendermint @pytest.mark.bdb def test_upsert_validator_invalid_election_vote(b_mock, valid_election, ed25519_node_keys): b_mock.store_bulk_transactions([valid_election]) @@ -112,7 +108,6 @@ def test_upsert_validator_invalid_election_vote(b_mock, valid_election, ed25519_ assert vote.validate(b_mock) -@pytest.mark.tendermint @pytest.mark.bdb def test_valid_election_votes_received(b_mock, valid_election, ed25519_node_keys): alice = generate_key_pair() @@ -158,7 +153,6 @@ def test_valid_election_votes_received(b_mock, valid_election, ed25519_node_keys assert valid_election.get_commited_votes(b_mock) == votes-2 -@pytest.mark.tendermint @pytest.mark.bdb def test_valid_election_conclude(b_mock, valid_election, ed25519_node_keys): @@ -272,7 +266,6 @@ def test_upsert_validator(b, node_key, node_keys, ed25519_node_keys): assert (public_key64 in validator_pub_keys) -@pytest.mark.tendermint @pytest.mark.bdb def test_get_validator_update(b, node_keys, node_key, ed25519_node_keys): reset_validator_set(b, node_keys, 1) diff --git a/tests/validation/test_transaction_structure.py b/tests/validation/test_transaction_structure.py index cecb51d7..32622c87 100644 --- a/tests/validation/test_transaction_structure.py +++ b/tests/validation/test_transaction_structure.py @@ -17,8 +17,6 @@ from bigchaindb.common.exceptions import (AmountError, ThresholdTooDeep) from bigchaindb.models import Transaction -pytestmark = pytest.mark.tendermint - ################################################################################ # Helper functions diff --git a/tests/web/test_assets.py b/tests/web/test_assets.py index 2c658cdc..a5d3260e 100644 --- a/tests/web/test_assets.py +++ b/tests/web/test_assets.py @@ -7,7 +7,6 @@ import pytest ASSETS_ENDPOINT = '/api/v1/assets/' -@pytest.mark.tendermint def test_get_assets_with_empty_text_search(client): res = client.get(ASSETS_ENDPOINT + '?search=') assert res.json == {'status': 400, @@ -15,14 +14,12 @@ def test_get_assets_with_empty_text_search(client): assert res.status_code == 400 -@pytest.mark.tendermint def test_get_assets_with_missing_text_search(client): res = client.get(ASSETS_ENDPOINT) assert res.status_code == 400 @pytest.mark.bdb -@pytest.mark.tendermint def test_get_assets_tendermint(client, b, alice): from bigchaindb.models import Transaction @@ -49,7 +46,6 @@ def test_get_assets_tendermint(client, b, alice): @pytest.mark.bdb -@pytest.mark.tendermint def test_get_assets_limit_tendermint(client, b, alice): from bigchaindb.models import Transaction diff --git a/tests/web/test_block_tendermint.py b/tests/web/test_block_tendermint.py index a92822c4..2f789c55 100644 --- a/tests/web/test_block_tendermint.py +++ b/tests/web/test_block_tendermint.py @@ -9,8 +9,6 @@ from bigchaindb.lib import Block BLOCKS_ENDPOINT = '/api/v1/blocks/' -pytestmark = pytest.mark.tendermint - @pytest.mark.bdb @pytest.mark.usefixtures('inputs') @@ -73,29 +71,3 @@ def test_get_blocks_by_txid_endpoint_returns_empty_list_not_found(client): res = client.get(BLOCKS_ENDPOINT + '?transaction_id=123') assert res.status_code == 200 assert len(res.json) == 0 - - -@pytest.mark.bdb -def test_get_blocks_by_txid_endpoint_returns_400_bad_query_params(client): - res = client.get(BLOCKS_ENDPOINT) - assert res.status_code == 400 - - res = client.get(BLOCKS_ENDPOINT + '?ts_id=123') - assert res.status_code == 400 - assert res.json == { - 'message': { - 'transaction_id': 'Missing required parameter in the JSON body or the post body or the query string' - } - } - - res = client.get(BLOCKS_ENDPOINT + '?transaction_id=123&foo=123') - assert res.status_code == 400 - assert res.json == { - 'message': 'Unknown arguments: foo' - } - - res = client.get(BLOCKS_ENDPOINT + '?transaction_id=123&status=123') - assert res.status_code == 400 - assert res.json == { - 'message': 'Unknown arguments: status' - } diff --git a/tests/web/test_blocks.py b/tests/web/test_blocks.py index aa792b7f..e0130613 100644 --- a/tests/web/test_blocks.py +++ b/tests/web/test_blocks.py @@ -50,7 +50,5 @@ def test_get_blocks_by_txid_endpoint_returns_400_bad_query_params(client): res = client.get(BLOCKS_ENDPOINT + '?transaction_id=123&status=123') assert res.status_code == 400 assert res.json == { - 'message': { - 'status': '123 is not a valid choice' - } + 'message': 'Unknown arguments: status' } diff --git a/tests/web/test_info.py b/tests/web/test_info.py index c2ba9bc3..b91b6f60 100644 --- a/tests/web/test_info.py +++ b/tests/web/test_info.py @@ -43,6 +43,7 @@ def test_api_v1_endpoint(client, wsserver_base_url): 'streams': '{}/api/v1/streams/valid_transactions'.format( wsserver_base_url), 'metadata': '/metadata/', + 'validators': '/validators' } res = client.get('/api/v1') assert res.json == api_v1_info diff --git a/tests/web/test_metadata.py b/tests/web/test_metadata.py index 248ef946..c1e6c5ed 100644 --- a/tests/web/test_metadata.py +++ b/tests/web/test_metadata.py @@ -7,7 +7,6 @@ import pytest METADATA_ENDPOINT = '/api/v1/metadata/' -@pytest.mark.tendermint def test_get_metadata_with_empty_text_search(client): res = client.get(METADATA_ENDPOINT + '?search=') assert res.json == {'status': 400, @@ -15,14 +14,12 @@ def test_get_metadata_with_empty_text_search(client): assert res.status_code == 400 -@pytest.mark.tendermint def test_get_metadata_with_missing_text_search(client): res = client.get(METADATA_ENDPOINT) assert res.status_code == 400 @pytest.mark.bdb -@pytest.mark.tendermint def test_get_metadata_tendermint(client, b, alice): from bigchaindb.models import Transaction @@ -50,7 +47,6 @@ def test_get_metadata_tendermint(client, b, alice): @pytest.mark.bdb -@pytest.mark.tendermint def test_get_metadata_limit_tendermint(client, b, alice): from bigchaindb.models import Transaction diff --git a/tests/web/test_outputs.py b/tests/web/test_outputs.py index 7cf1ab5e..db7b718d 100644 --- a/tests/web/test_outputs.py +++ b/tests/web/test_outputs.py @@ -10,7 +10,6 @@ pytestmark = [pytest.mark.bdb, pytest.mark.usefixtures('inputs')] OUTPUTS_ENDPOINT = '/api/v1/outputs/' -@pytest.mark.tendermint def test_get_outputs_endpoint(client, user_pk): m = MagicMock() m.txid = 'a' @@ -26,7 +25,6 @@ def test_get_outputs_endpoint(client, user_pk): gof.assert_called_once_with(user_pk, None) -@pytest.mark.tendermint def test_get_outputs_endpoint_unspent(client, user_pk): m = MagicMock() m.txid = 'a' @@ -40,7 +38,6 @@ def test_get_outputs_endpoint_unspent(client, user_pk): gof.assert_called_once_with(user_pk, False) -@pytest.mark.tendermint def test_get_outputs_endpoint_spent(client, user_pk): m = MagicMock() m.txid = 'a' @@ -54,13 +51,11 @@ def test_get_outputs_endpoint_spent(client, user_pk): gof.assert_called_once_with(user_pk, True) -@pytest.mark.tendermint def test_get_outputs_endpoint_without_public_key(client): res = client.get(OUTPUTS_ENDPOINT) assert res.status_code == 400 -@pytest.mark.tendermint def test_get_outputs_endpoint_with_invalid_public_key(client): expected = {'message': {'public_key': 'Invalid base58 ed25519 key'}} res = client.get(OUTPUTS_ENDPOINT + '?public_key=abc') @@ -68,7 +63,6 @@ def test_get_outputs_endpoint_with_invalid_public_key(client): assert res.status_code == 400 -@pytest.mark.tendermint def test_get_outputs_endpoint_with_invalid_spent(client, user_pk): expected = {'message': {'spent': 'Boolean value must be "true" or "false" (lowercase)'}} params = '?spent=tru&public_key={}'.format(user_pk) @@ -87,8 +81,7 @@ def test_get_divisble_transactions_returns_500(b, client): TX_ENDPOINT = '/api/v1/transactions' def mine(tx_list): - block = b.create_block(tx_list) - b.write_block(block) + b.store_bulk_transactions(tx_list) alice_priv, alice_pub = crypto.generate_key_pair() bob_priv, bob_pub = crypto.generate_key_pair() diff --git a/tests/web/test_parameters.py b/tests/web/test_parameters.py index 3eb8ab2a..ccf3119b 100644 --- a/tests/web/test_parameters.py +++ b/tests/web/test_parameters.py @@ -4,8 +4,6 @@ import pytest -pytestmark = pytest.mark.tendermint - def test_valid_txid(): from bigchaindb.web.views.parameters import valid_txid diff --git a/tests/web/test_server.py b/tests/web/test_server.py index 5fce3629..215aa980 100644 --- a/tests/web/test_server.py +++ b/tests/web/test_server.py @@ -2,10 +2,6 @@ # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 -import pytest - -pytestmark = pytest.mark.tendermint - def test_settings(): import bigchaindb diff --git a/tests/web/test_transactions.py b/tests/web/test_transactions.py index 97386da0..68df7f8b 100644 --- a/tests/web/test_transactions.py +++ b/tests/web/test_transactions.py @@ -23,7 +23,6 @@ def test_get_transaction_endpoint(client, posted_create_tx): assert res.status_code == 200 -@pytest.mark.tendermint def test_get_transaction_returns_404_if_not_found(client): res = client.get(TX_ENDPOINT + '123') assert res.status_code == 404 @@ -361,7 +360,6 @@ def test_post_wrong_asset_division_transfer_returns_400(b, client, user_pk): assert res.json['message'] == expected_error_message -@pytest.mark.tendermint def test_transactions_get_list_good(client): from functools import partial @@ -388,7 +386,6 @@ def test_transactions_get_list_good(client): ] -@pytest.mark.tendermint def test_transactions_get_list_bad(client): def should_not_be_called(): assert False @@ -405,7 +402,6 @@ def test_transactions_get_list_bad(client): assert client.get(url).status_code == 400 -@pytest.mark.tendermint @patch('requests.post') @pytest.mark.parametrize('mode', [ ('', 'broadcast_tx_async'), diff --git a/tests/web/test_validators.py b/tests/web/test_validators.py index 52420828..0574204f 100644 --- a/tests/web/test_validators.py +++ b/tests/web/test_validators.py @@ -2,10 +2,6 @@ # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 -import pytest - -pytestmark = pytest.mark.tendermint - VALIDATORS_ENDPOINT = '/api/v1/validators/' diff --git a/tests/web/test_websocket_server.py b/tests/web/test_websocket_server.py index a3de508a..dff74f21 100644 --- a/tests/web/test_websocket_server.py +++ b/tests/web/test_websocket_server.py @@ -10,8 +10,6 @@ from unittest.mock import patch import pytest -pytestmark = pytest.mark.tendermint - class MockWebSocket: def __init__(self):