diff --git a/tests/test_request.py b/tests/test_request.py index a2bd4cade7..24be368b34 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -186,7 +186,10 @@ def authenticate(self, request): try: self.request.user except AttributeError as error: - self.assertEqual(str(error), "'module' object has no attribute 'MISSPELLED_NAME_THAT_DOESNT_EXIST'") + assert str(error) in ( + "'module' object has no attribute 'MISSPELLED_NAME_THAT_DOESNT_EXIST'", # Python < 3.5 + "module 'rest_framework' has no attribute 'MISSPELLED_NAME_THAT_DOESNT_EXIST'", # Python >= 3.5 + ) else: assert False, 'AttributeError not raised'