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.

Source Distribution

deasync-1.0.1.zip (4.2 kB view details)

Uploaded Source

Built Distribution

deasync-1.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file deasync-1.0.1.zip.

File metadata

  • Download URL: deasync-1.0.1.zip
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for deasync-1.0.1.zip
Algorithm Hash digest
SHA256 f2fb7b986b478ad86dccac21d97c7a6f5faaf6547f5db7436fb43d82bbd64d24
MD5 54e5997f94fe97797e9b86179236108d
BLAKE2b-256 123d31fe5bc237f57f42657a3c3e319c90f1d4f391ca681f04e61ada4ea898ec

See more details on using hashes here.

File details

Details for the file deasync-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for deasync-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd747220f656fdcd0ca60b042cb82883257f7dc8393eabf37fdcf380630c132f
MD5 abcb6f3f9b00d6216d0bc09bd59f2174
BLAKE2b-256 a8f12649dbacefa57f6485079e6139306aa4e838a83c465e8f13a1ec31900c6c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page