summaryrefslogtreecommitdiff
path: root/tests/frontend/version.py
blob: 997eb2340d0e7e6433c79d654af495b65127717f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from tests.testutils.runcli import cli

# For utils.get_bst_version()
from buildstream import utils


def assert_version(cli_version_output):
    major, minor = utils.get_bst_version()
    expected_start = "{}.{}".format(major, minor)
    if not cli_version_output.startswith(expected_start):
        raise AssertionError("Version output expected to begin with '{}',"
                             .format(expected_start) +
                             " output was: {}"
                             .format(cli_version_output))


def test_version(cli):
    result = cli.run(args=['--version'])
    result.assert_success()
    assert_version(result.output)