Skip to content

Commit

Permalink
[Resolve #1520] Replace hard-coded shell paths (#1523)
Browse files Browse the repository at this point in the history
Replaced hard-coded shell paths in some unit tests.
  • Loading branch information
dboitnot authored Oct 7, 2024
1 parent 515e596 commit e344f2d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/test_hooks/test_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,21 @@ def test_hook_writes_to_stderr(stack, capfd):
def test_default_shell_is_sh(stack, capfd):
Cmd("echo $0", stack).run()
cap = capfd.readouterr()
assert cap.out.strip() == "/bin/sh"
assert cap.out.strip().split("/")[-2:] == ["bin", "sh"]
assert cap.err.strip() == ""


def test_shell_parameter_sets_the_shell(stack, capfd):
Cmd({"run": "echo $0", "shell": "/bin/bash"}, stack).run()
# Determine the local path to bash (it's not always /bin/bash)
Cmd("echo $0", stack).run()
cap = capfd.readouterr()
assert cap.err.strip() == ""
bash = cap.out.strip()

# Confirm the correct shell is used in the sub-process
Cmd({"run": "echo $0", "shell": bash}, stack).run()
cap = capfd.readouterr()
assert cap.out.strip() == "/bin/bash"
assert cap.out.strip() == bash
assert cap.err.strip() == ""


Expand Down

0 comments on commit e344f2d

Please sign in to comment.