mirror of
https://github.com/jazzband/django-analytical.git
synced 2026-03-16 22:20:25 +00:00
Use assertRaisesRegex when available.
This commit is contained in:
parent
dcf51bc6ca
commit
67f29fdb2b
1 changed files with 7 additions and 2 deletions
|
|
@ -19,8 +19,13 @@ class SettingDeletedTestCase(TestCase):
|
|||
"""
|
||||
Make sure using get_required_setting fails in the right place.
|
||||
"""
|
||||
# only available in python >= 2.7
|
||||
if hasattr(self, 'assertRaisesRegexp'):
|
||||
|
||||
# available in python >= 3.2
|
||||
if hasattr(self, 'assertRaisesRegex'):
|
||||
with self.assertRaisesRegex(AnalyticalException, "^USER_ID setting is set to None$"):
|
||||
user_id = get_required_setting("USER_ID", "\d+", "invalid USER_ID")
|
||||
# available in python >= 2.7, deprecated in 3.2
|
||||
elif hasattr(self, 'assertRaisesRegexp'):
|
||||
with self.assertRaisesRegexp(AnalyticalException, "^USER_ID setting is set to None$"):
|
||||
user_id = get_required_setting("USER_ID", "\d+", "invalid USER_ID")
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue