summaryrefslogtreecommitdiffstats
path: root/test/conftest.py
blob: 1a043a91fa788328bfa4f98686d6f45e68849037 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pytest
import os
from .py import helper


@pytest.fixture(scope='function')
def barebox(strategy, target):
    strategy.transition('barebox')
    return target.get_driver('BareboxDriver')

@pytest.fixture(scope="session")
def barebox_config(strategy, target):
    strategy.transition('barebox')
    command = target.get_driver("BareboxDriver")
    return helper.get_config(command)

def pytest_configure(config):
    if 'LG_BUILDDIR' not in os.environ:
        if 'KBUILD_OUTPUT' in os.environ:
            os.environ['LG_BUILDDIR'] = os.environ['KBUILD_OUTPUT']
        elif os.path.isdir('build'):
            os.environ['LG_BUILDDIR'] = os.path.realpath('build')
        else:
            os.environ['LG_BUILDDIR'] = os.getcwd()

    if os.environ['LG_BUILDDIR'] is not None:
        os.environ['LG_BUILDDIR'] = os.path.realpath(os.environ['LG_BUILDDIR'])