Until now, I've been using this approach to check error strings in the test suite.
with pytest.raises(ValueError) as ve:
microhapulator.some.operation(baddata)
assert 'expected error message' in str(ve)
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.