Skip to main content

deasync decorator to make async functions/methods synchronous.

Project description

deasync provides a decorator called deasync for Python 3.5 (or higher) to make async functions synchronous in places where only synchronous functions are expected, for example in unittest.TestCase:

from asyncio import sleep
from unittest import TestCase
from deasync import deasync


async def function42():
    await sleep(0.001)
    return 42


class TestFunction42(TestCase):
    @deasync
    async def test_function42(self):
        result = await function42()
        self.assertEquals(42, result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
deasync-1.0.1-py3-none-any.whl (3.5 kB) Copy SHA256 hash SHA256 Wheel py3 Jan 18, 2017
deasync-1.0.1.zip (4.2 kB) Copy SHA256 hash SHA256 Source None Jan 24, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page