summaryrefslogtreecommitdiff
path: root/tests/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/__init__.py')
-rw-r--r--tests/__init__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index 7903a95..dd5086b 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,13 +1,16 @@
import aioeventlet
+import sys
try:
import asyncio
except ImportError:
import trollius as asyncio
try:
# On Python 2.6, unittest2 is needed to get new features like addCleanup()
- import unittest2 as unittest
+ import unittest2
+ unittest = unittest2
except ImportError:
import unittest
+ unittest2 = None
try:
from unittest import mock
except ImportError:
@@ -22,3 +25,7 @@ class TestCase(unittest.TestCase):
self.loop = policy.get_event_loop()
self.addCleanup(self.loop.close)
self.addCleanup(asyncio.set_event_loop, None)
+
+ if sys.version_info < (3,) and unittest2 is None:
+ def assertRaisesRegex(self, *args):
+ return self.assertRaisesRegexp(*args)