I have the following
The contents of
#!/bin/sh error_file=$(mktemp) coverage run --source "$PWD" --branch -m pytest tests/ >"$error_file" 2>&1 if test $?; then coverage report --show-missing else cat "$error_file" fi
If the tests pass, I want to only show the coverage information. If the tests fail, I only want to show the test information.
However, on both passing and failing tests,
$? is always 0, i.e. a success.
If I copy and paste the
coverage run ... command in the terminal and manually inspect
echo $? I do get 0 for success and 1 for failing tests.
It seems that the value of
$? is being altered by some other command that Vim is executing in the
How best to resolve this?