summaryrefslogtreecommitdiff
path: root/tests/frontend/version.py
blob: 1d36a33b529a0767ef55a3537ae3a006c0cc0f68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from buildstream.plugintestutils.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)