mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Add config to blueprint and fix tests madness
There was a problem related to the import of the module `bigchaindb.web.views`. The module, when imported, inizialises a new `Bigchain` instance, and this is wrong for testing and because it's a bad practice. I spent more or less 2h finding out the problem.
This commit is contained in:
parent
6d808ba614
commit
41bd2545c9
@ -7,13 +7,14 @@ Tasks:
|
||||
"""
|
||||
|
||||
import os
|
||||
import copy
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
DB_NAME = 'bigchain_test_{}'.format(os.getpid())
|
||||
|
||||
config = {
|
||||
CONFIG = {
|
||||
'database': {
|
||||
'name': DB_NAME
|
||||
},
|
||||
@ -36,7 +37,7 @@ def restore_config(request, node_config):
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def node_config():
|
||||
return config
|
||||
return copy.deepcopy(CONFIG)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@ -50,7 +51,8 @@ def user_public_key():
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def b():
|
||||
def b(request, node_config):
|
||||
restore_config(request, node_config)
|
||||
from bigchaindb import Bigchain
|
||||
return Bigchain()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user