conftest.py 922 Bytes
Newer Older
1
2
3
4
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
Benoit Formet's avatar
Benoit Formet committed
5
# Copyright (c) 2015-2020 Beamline Control Unit, ESRF
6
7
8
9
# Distributed under the GNU LGPLv3. See LICENSE for more info.

import pytest

10
11
12
13
14
15
16
17
18
19
from bliss.config import static
from bliss.config.conductor import client


@pytest.fixture
def beacon_beamline():
    static.CONFIG = None
    client._default_connection = None
    config = static.get_config()
    yield config
20
    config.close()
21
22
23
    client._default_connection = None
    static.CONFIG = None

24
25

def pytest_collection_modifyitems(config, items):
26
    devices = ["pepu", "ct2", "axis"]
27
28
29
30
31
32
33
34
35
36
    for name in devices:
        try:
            if config.getoption("--%s" % name):
                continue
        except ValueError:
            continue
        # Remove device tests if no option is provided
        for item in list(items):
            if name in item.keywords:
                items.remove(item)