conftest.py 1.03 KB
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
from bliss.config import static
from bliss.config.conductor import client


@pytest.fixture
def beacon_beamline():
16
17
18
19
20
21
    """
    Fixture to retreive configuration objects from beamline beacon
    and not from test beacon.
    """

    static.Config.instance = None
22
23
24
    client._default_connection = None
    config = static.get_config()
    yield config
25
    config.close()
26
    client._default_connection.close()
27
28
    client._default_connection = None

29
30

def pytest_collection_modifyitems(config, items):
31
    devices = ["pepu", "ct2", "axis"]
32
33
34
35
36
37
38
39
40
41
    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)