blob: 2ed0eff42140d77367a456eb6b7cf15b70ff64e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import aiogreen
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
except ImportError:
import unittest
try:
from unittest import mock
except ImportError:
import mock
class TestCase(unittest.TestCase):
def setUp(self):
policy = aiogreen.EventletEventLoopPolicy()
asyncio.set_event_loop_policy(policy)
self.addCleanup(asyncio.set_event_loop_policy, None)
self.loop = policy.get_event_loop()
self.addCleanup(self.loop.close)
self.addCleanup(asyncio.set_event_loop, None)
|