Import std libs at the top

the rationale behind importing under a test function is to import what
is being tested, and perhasp likely to fail, to isolate possible errors
resulting from the import itself

see
http://docs.pylonsproject.org/en/latest/community/testing.html#rule-never-import-the-module-under-test-at-test-module-scope for more
This commit is contained in:
Sylvain Bellemare 2016-12-05 14:19:12 +01:00
parent f341bd1586
commit 8c1dbc86a0

View File

@ -1,7 +1,8 @@
import pytest
from functools import singledispatch
from types import ModuleType
import pytest
@pytest.fixture
def mock_module():
@ -9,7 +10,6 @@ def mock_module():
def test_module_dispatch_registers(mock_module):
from functools import singledispatch
from bigchaindb.backend.utils import make_module_dispatch_registrar
@singledispatch
@ -26,7 +26,6 @@ def test_module_dispatch_registers(mock_module):
def test_module_dispatch_dispatches(mock_module):
from functools import singledispatch
from bigchaindb.backend.utils import make_module_dispatch_registrar
@singledispatch