Verified Commit 03280967 authored by Karel Koci's avatar Karel Koci 🤘
Browse files

tests/conftest: change scope of top level fixtures to session

This was causing issue when tests from multiple packages were run in one
session as serial console is not correctly closed on cleanup of board
fixture.

These should be session anyway as they do not cause any conflict with
anything else (compare to boot_serial that boots and reboots the
router). There is no reason why we would want the new instances of these
objects, rather the opposite.
parent cd479b30
......@@ -70,25 +70,25 @@ def pytest_runtest_setup(item):
########################################################################################################################
# Resources shared among all tests #####################################################################################
@pytest.fixture(name="board", scope="package")
@pytest.fixture(name="board", scope="session")
def fixture_board(request):
"""Brings board on. Nothing else.
This is top most fixture for board. It returns board handle.
This is top most fixture for board. It provides board handle.
"""
brd = nsfarm.board.get_board(request.config.target_config)
brd.power(True)
request.addfinalizer(lambda: brd.power(False))
return brd
yield brd
brd.power(False)
@pytest.fixture(name="lxd", scope="package")
@pytest.fixture(name="lxd", scope="session")
def fixture_lxd():
"""Provides access to nsfarm.lxd.LXDConnection instance.
"""
return nsfarm.lxd.LXDConnection()
@pytest.fixture(name="device_map", scope="package")
@pytest.fixture(name="device_map", scope="session")
def fixture_device_map(request):
"""Provides easier access to device map generated by target.
"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment