diff options
Diffstat (limited to 'tests/frontend/interactive_init.py')
-rw-r--r-- | tests/frontend/interactive_init.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/tests/frontend/interactive_init.py b/tests/frontend/interactive_init.py index c8f169000..b8cbe522f 100644 --- a/tests/frontend/interactive_init.py +++ b/tests/frontend/interactive_init.py @@ -1,23 +1,33 @@ import os import pexpect -from ruamel import yaml -from buildstream._versions import BST_FORMAT_VERSION +from buildstream import _yaml +from buildstream import utils from tests.testutils.constants import PEXPECT_TIMEOUT_SHORT def test_init(tmpdir): session = pexpect.spawn("bst", ["--no-colors", "init", str(tmpdir)], timeout=PEXPECT_TIMEOUT_SHORT) name = "test-project" - format_version = 24 + min_version = "2.0" element_path = "my-elements" + bst_major, bst_minor = utils.get_bst_version() + + # For the version check, artificially set the version to at least + # version 2.0 + # + # TODO: Remove this code block after releasing 2.0 + # + if bst_major < 2: + bst_major = 2 + bst_minor = 0 session.expect_exact("Project name:") session.sendline(name) - session.expect_exact("Format version [{}]:".format(BST_FORMAT_VERSION)) - session.sendline(str(format_version)) + session.expect_exact("Minimum version [{}.{}]:".format(bst_major, bst_minor)) + session.sendline(str(min_version)) session.expect_exact("Element path [elements]:") session.sendline(element_path) @@ -26,9 +36,7 @@ def test_init(tmpdir): session.close() # Now assert that a project.conf got created with expected values - with open(os.path.join(str(tmpdir), "project.conf")) as f: - project_conf = yaml.safe_load(f) - - assert project_conf["name"] == name - assert project_conf["format-version"] == format_version - assert project_conf["element-path"] == element_path + project_conf = _yaml.load(os.path.join(str(tmpdir), "project.conf")) + assert project_conf.get_str("name") == name + assert project_conf.get_str("min-version") == min_version + assert project_conf.get_str("element-path") == element_path |