File: __init__.py

package info (click to toggle)
python-inject 5.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 224 kB
  • sloc: python: 1,044; makefile: 28; sh: 5
file content (17 lines) | stat: -rw-r--r-- 385 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from unittest import TestCase
import asyncio
import inject


class BaseTestInject(TestCase):
    def tearDown(self):
        inject.clear()
    
    def run_async(self, awaitable):
        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)
        try:
            ret = loop.run_until_complete(awaitable)
        finally:
            loop.close()
        return ret