Skip to content

Commit

Permalink
New test
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Nov 7, 2023
1 parent 86f23a4 commit fde177d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion testsuite/drivers/alr.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def alr_with(dep="", path="", url="", commit="", branch="",
return run_alr(*args, force=force)


def add_action(type, command, name="", directory=""):
def add_action(type: str, command: [str], name="", directory=""):
"""
Add an action to the manifest in the current directory.
:param str type: "pre-build", etc
Expand Down
8 changes: 8 additions & 0 deletions testsuite/drivers/asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,11 @@ def match_deploy_dir(crate : str, path_fragment : str):
assert_match(f".*[: ]{crate.upper()}_ALIRE_PREFIX=[^\\n]*"
f"{re.escape(path_fragment)}[^\\n]*{crate}_.*",
p.out)


def assert_substring(target: str, text: str):
"""
Check that a string is contained in another string
"""
assert target in text, \
f"Missing expected string '{target}' in text:\n{text}"
17 changes: 17 additions & 0 deletions testsuite/tests/action/missing-exec/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Check that an action trying to run a missing executable reports such an error.
"""

from drivers.alr import run_alr, add_action, init_local_crate
from drivers.asserts import assert_substring

init_local_crate()

add_action('pre-build', ['fake-missing-exec'])

p = run_alr("build", complain_on_error=False)

assert_substring("Command not found [fake-missing-exec]",
p.out)

print('SUCCESS')
3 changes: 3 additions & 0 deletions testsuite/tests/action/missing-exec/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
driver: python-script
build_mode: both
indexes: {}

0 comments on commit fde177d

Please sign in to comment.