You should use sklearn.utils.testing.asser_raises_message here.