diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-11-27 14:32:20 +0000 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2018-12-11 16:15:19 +0000 |
commit | 9b192015d1e6789bcdc557ab3f537e1a9a31d557 (patch) | |
tree | c73fbd79974a4133863d25dc3652cc109f92ff0d /tests/integration/shell.py | |
parent | a1dee91ec00cc51b21acc1274887225325ea7baa (diff) | |
download | buildstream-9b192015d1e6789bcdc557ab3f537e1a9a31d557.tar.gz |
tests: Add tests for guessing element names
This is a part of #222
Diffstat (limited to 'tests/integration/shell.py')
-rw-r--r-- | tests/integration/shell.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/integration/shell.py b/tests/integration/shell.py index 1cec21818..983cab6b5 100644 --- a/tests/integration/shell.py +++ b/tests/integration/shell.py @@ -358,13 +358,22 @@ def test_integration_devices(cli, tmpdir, datafiles): # Test that a shell can be opened from an external workspace @pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("build_shell", [("build"), ("nobuild")]) +@pytest.mark.parametrize("guess_element", [True, False], ids=["guess", "no-guess"]) @pytest.mark.skipif(IS_LINUX and not HAVE_BWRAP, reason='Only available with bubblewrap on Linux') -def test_integration_external_workspace(cli, tmpdir_factory, datafiles, build_shell): +def test_integration_external_workspace(cli, tmpdir_factory, datafiles, build_shell, guess_element): tmpdir = tmpdir_factory.mktemp("") project = os.path.join(datafiles.dirname, datafiles.basename) element_name = 'autotools/amhello.bst' workspace_dir = os.path.join(str(tmpdir), 'workspace') + if guess_element: + # Mutate the project.conf to use a default shell command + project_file = os.path.join(project, 'project.conf') + config_text = "shell:\n"\ + " command: ['true']\n" + with open(project_file, 'a') as f: + f.write(config_text) + result = cli.run(project=project, args=[ 'workspace', 'open', '--directory', workspace_dir, element_name ]) @@ -373,9 +382,10 @@ def test_integration_external_workspace(cli, tmpdir_factory, datafiles, build_sh result = cli.run(project=project, args=['-C', workspace_dir, 'build', element_name]) result.assert_success() - command = ['shell'] + command = ['-C', workspace_dir, 'shell'] if build_shell == 'build': command.append('--build') - command.extend([element_name, '--', 'true']) + if not guess_element: + command.extend([element_name, '--', 'true']) result = cli.run(project=project, cwd=workspace_dir, args=command) result.assert_success() |