Use assert_raises_regexp to check error messages
Merge pull request #2760 from AlexanderFabisch/check_error_patterns

[MRG] Check error message with regex