diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-10-24 16:40:32 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-10-31 09:40:08 +0000 |
commit | f3922f4fff1a81dff3de5328e6a7165b6d87c217 (patch) | |
tree | 02a9a61b18d16ec0b831432f3b6d811c60c3a0cd | |
parent | c879470b947c11119bddff9f161f77aae14a23ee (diff) | |
download | buildstream-f3922f4fff1a81dff3de5328e6a7165b6d87c217.tar.gz |
tests/.../missing_dependencies: include git
Symlink `git` into the separate tools bin directory. BuildStream needs
`git` in order to be able to determine its version.
This missing dependency is revealed when you run these tests in `spawn`
mode, as it will re-run the base __init__.__version__ logic in a new
process.
Also take the opportunity to extract _symlink_host_tools_to_dir(), to
re-use some code.
-rw-r--r-- | tests/sandboxes/missing_dependencies.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/sandboxes/missing_dependencies.py b/tests/sandboxes/missing_dependencies.py index 975c8eb00..a5bf31e76 100644 --- a/tests/sandboxes/missing_dependencies.py +++ b/tests/sandboxes/missing_dependencies.py @@ -18,13 +18,19 @@ DATA_DIR = os.path.join( ) +def _symlink_host_tools_to_dir(host_tools, dir_): + dir_.mkdir(exist_ok=True) + for tool in host_tools: + target_path = dir_ / tool + os.symlink(utils.get_host_tool(tool), str(target_path)) + + @pytest.mark.skipif(not IS_LINUX, reason='Only available on Linux') @pytest.mark.datafiles(DATA_DIR) -def test_missing_brwap_has_nice_error_message(cli, datafiles, tmp_path): - # Create symlink to buildbox-casd to work with custom PATH - buildbox_casd = tmp_path.joinpath('bin/buildbox-casd') - buildbox_casd.parent.mkdir() - os.symlink(utils.get_host_tool('buildbox-casd'), str(buildbox_casd)) +def test_missing_bwrap_has_nice_error_message(cli, datafiles, tmp_path): + # Create symlink to buildbox-casd and git to work with custom PATH + bin_dir = tmp_path / "bin" + _symlink_host_tools_to_dir(['buildbox-casd', 'git'], bin_dir) project = str(datafiles) element_path = os.path.join(project, 'elements', 'element.bst') @@ -50,7 +56,7 @@ def test_missing_brwap_has_nice_error_message(cli, datafiles, tmp_path): result = cli.run( project=project, args=['build', 'element.bst'], - env={'PATH': str(tmp_path.joinpath('bin')), + env={'PATH': str(bin_dir), 'BST_FORCE_SANDBOX': None}) result.assert_task_error(ErrorDomain.SANDBOX, 'unavailable-local-sandbox') assert "not found" in result.stderr @@ -69,9 +75,9 @@ def test_old_brwap_has_nice_error_message(cli, datafiles, tmp_path): bwrap.chmod(0o755) - # Create symlink to buildbox-casd to work with custom PATH - buildbox_casd = tmp_path.joinpath('bin/buildbox-casd') - os.symlink(utils.get_host_tool('buildbox-casd'), str(buildbox_casd)) + # Create symlink to buildbox-casd and git to work with custom PATH + bin_dir = tmp_path / "bin" + _symlink_host_tools_to_dir(['buildbox-casd', 'git'], bin_dir) project = str(datafiles) element_path = os.path.join(project, 'elements', 'element3.bst') @@ -97,7 +103,7 @@ def test_old_brwap_has_nice_error_message(cli, datafiles, tmp_path): result = cli.run( project=project, args=['--debug', '--verbose', 'build', 'element3.bst'], - env={'PATH': str(tmp_path.joinpath('bin')), + env={'PATH': str(bin_dir), 'BST_FORCE_SANDBOX': None}) result.assert_task_error(ErrorDomain.SANDBOX, 'unavailable-local-sandbox') assert "too old" in result.stderr |