Skip to content

Commit 746bb17

Browse files
author
Ryan P Kilby
committed
Fix test for py2k
1 parent d69f44a commit 746bb17

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/test_request.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ def authenticate(self, request):
230230
with pytest.raises(WrappedAttributeError, match=expected):
231231
request.user
232232

233+
# python 2 hasattr fails for *any* exception, not just AttributeError
234+
if six.PY2:
235+
return
236+
237+
with pytest.raises(WrappedAttributeError, match=expected):
238+
hasattr(request, 'user')
239+
233240
with pytest.raises(WrappedAttributeError, match=expected):
234241
login(request, self.user)
235242

0 commit comments

Comments
 (0)