From ebd1e85678cfd32de2562505814074c503a886c2 Mon Sep 17 00:00:00 2001 From: Ryan P Kilby Date: Wed, 15 Nov 2017 20:06:35 -0500 Subject: [PATCH] Fix test for py2k --- tests/test_request.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_request.py b/tests/test_request.py index 66bb70929..3e66e4a13 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -230,6 +230,13 @@ class TestUserSetter(TestCase): with pytest.raises(WrappedAttributeError, match=expected): request.user + # python 2 hasattr fails for *any* exception, not just AttributeError + if six.PY2: + return + + with pytest.raises(WrappedAttributeError, match=expected): + hasattr(request, 'user') + with pytest.raises(WrappedAttributeError, match=expected): login(request, self.user)