compliance-trestle
compliance-trestle copied to clipboard
execute_command_and_assert should include optional check on error message string to confirm expected error happened
Issue description / feature objectives
Related to #1267 many tests that use execute_command_and_assert simply check the return code but do not confirm that the expected error occurred rather than something unrelated. It should be reworked to allow specifying an optional string expected in the error message and verify not only the error code but also the error message contents.
There are many occurrences of this command in the tests, but only the ones with a non-zero return code would need reworking - so the number is not huge.
See cache_test.py for examples using pytest.raises
and its match
option: https://docs.pytest.org/en/7.1.x/how-to/assert.html