From 41bd2545c95ce4702545984b465182c96a295be8 Mon Sep 17 00:00:00 2001 From: vrde Date: Thu, 3 Mar 2016 01:40:40 +0100 Subject: [PATCH] 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. --- conftest.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/conftest.py b/conftest.py index 96be00f6..3781b2b6 100644 --- a/conftest.py +++ b/conftest.py @@ -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()