Update usage of pytest.raises throughout the codebase
This PR closes #1541 (closed) by updating the use of pytest.raises
throughout the codebase to use the match
keyword. This cleans things up a wee bit, and naturally allows more flexibility in matching the error message (since pytest uses a regex, rather than simple string comparisons).