Fix pytest.raises compat issue

This commit is contained in:
Ryan P Kilby 2019-06-30 17:23:47 -07:00
parent 24c18fc3d6
commit 07b380b88c

View File

@ -535,9 +535,9 @@ class BasicAuthenticationUnitTests(TestCase):
authentication.authenticate = lambda **kwargs: MockUser() authentication.authenticate = lambda **kwargs: MockUser()
try: try:
auth = authentication.BasicAuthentication() auth = authentication.BasicAuthentication()
with pytest.raises(exceptions.AuthenticationFailed) as error: with pytest.raises(exceptions.AuthenticationFailed) as exc_info:
auth.authenticate_credentials('foo', 'bar') auth.authenticate_credentials('foo', 'bar')
assert 'User inactive or deleted.' in str(error) assert 'User inactive or deleted.' in str(exc_info.value)
finally: finally:
authentication.authenticate = old_authenticate authentication.authenticate = old_authenticate