# Pylint doesn't play well with fixtures and dependency injection from pytest
# pylint: disable=redefined-outer-name

from buildstream._testing.runcli import cli  # pylint: disable=unused-import


# 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)
