diff options
Diffstat (limited to 'tests/frontend/workspace.py')
-rw-r--r-- | tests/frontend/workspace.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py index 91004b9f4..a90ab97b2 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -1238,3 +1238,45 @@ def test_external_list(cli, datafiles, tmpdir_factory): result = cli.run(project=project, args=['-C', workspace, 'workspace', 'list']) result.assert_success() + + +# This strange test tests against a regression raised in issue #919, +# where opening a workspace on a runtime dependency of a build only +# dependency causes `bst build` to not build the specified target +# but just successfully builds the workspaced element and happily +# exits without completing the build. +# +BUILD_ALL_DIR = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "workspaced-build-dep", +) + + +@pytest.mark.datafiles(BUILD_ALL_DIR) +@pytest.mark.parametrize("strict", [("strict"), ("non-strict")]) +def test_build_all(cli, tmpdir, datafiles, strict): + project = str(datafiles) + workspace = os.path.join(str(tmpdir), 'workspace') + + # Configure strict mode + strict_mode = True + if strict != 'strict': + strict_mode = False + cli.configure({ + 'projects': { + 'test': { + 'strict': strict_mode + } + } + }) + + # First open the workspace + result = cli.run(project=project, args=['workspace', 'open', '--directory', workspace, 'elem1.bst']) + result.assert_success() + + # Now build the target elem3.bst + result = cli.run(project=project, args=['build', 'elem3.bst']) + result.assert_success() + + # Assert that the target is built + assert cli.get_element_state(project, 'elem3.bst') == 'cached' |