Closed standage closed 5 years ago
The new syntax:
with pytest.raises(ValueError, match=r'expected error message') as ve:
microhapulator.some.operation(baddata)
Relevant documentation: http://doc.pytest.org/en/latest/assert.html#assertions-about-expected-exceptions
Until now, I've been using this approach to check error strings in the test suite.
The
str(ve)
approach no longer works with pytest 5.x. The pytest version has been pinned temporarily in the CI configuration, but this should be addressed soon.