summaryrefslogtreecommitdiff
path: root/tests/format/projectoverrides.py
blob: 25360e1e5abcea9ea8b4d8469fa0f4e41259f918 (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
28
29
# Pylint doesn't play well with fixtures and dependency injection from pytest
# pylint: disable=redefined-outer-name

import os
import pytest
from buildstream import _yaml
from buildstream.plugintestutils.runcli import cli  # pylint: disable=unused-import

# Project directory
DATA_DIR = os.path.join(
    os.path.dirname(os.path.realpath(__file__)),
    "project-overrides"
)


@pytest.mark.datafiles(DATA_DIR)
def test_prepend_configure_commands(cli, datafiles):
    project = os.path.join(datafiles.dirname, datafiles.basename, 'prepend-configure-commands')
    result = cli.run(project=project, silent=True, args=[
        'show',
        '--deps', 'none',
        '--format', '%{config}',
        'element.bst'])

    result.assert_success()
    loaded = _yaml.load_data(result.output)
    config_commands = loaded['configure-commands']
    assert len(config_commands) == 3
    assert config_commands[0] == 'echo "Hello World!"'