diff --git a/tests/test_make.py b/tests/test_make.py index fda358393..ee0c1eccc 100644 --- a/tests/test_make.py +++ b/tests/test_make.py @@ -539,25 +539,21 @@ def test_sugar_factory_mutex(self): """ Passing both default and factory raises ValueError. """ - with pytest.raises(ValueError) as ei: + with pytest.raises(ValueError, match="mutually exclusive") as ei: @attr.s class C(object): x = attr.ib(factory=list, default=Factory(list)) - assert "mutually exclusive" in ei.value.args[0] - def test_sugar_callable(self): """ Factory has to be a callable to prevent people from passing Factory into it. """ - with pytest.raises(ValueError) as ei: + with pytest.raises(ValueError, match="must be a callable") as ei: @attr.s class C(object): x = attr.ib(factory=Factory(list)) - assert "must be a callable" in ei.value.args[0] - @attr.s class GC(object):