conftest.py 1.13 KB
Newer Older
1
2
3
4
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
5
# Copyright (c) 2015-2019 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
20
21
22
23
24
25
26
27
28
29
from bliss.config.channels import clear_cache, Bus
from bliss.config import static
from bliss.config.conductor import client
from bliss.config.conductor.client import get_default_connection


@pytest.fixture
def beacon_beamline():
    static.CONFIG = None
    client._default_connection = None
    config = static.get_config()
    connection = get_default_connection()
    yield config
    clear_cache()
    Bus.clear_cache()
    config._clear_instances()
    connection.close()
    client._default_connection = None
    static.CONFIG = None

30
31

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