summaryrefslogtreecommitdiff
path: root/tests/sandboxes/missing_dependencies.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sandboxes/missing_dependencies.py')
-rw-r--r--tests/sandboxes/missing_dependencies.py26
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