Skip to main content

Very awesome dryrun module for python

Project description

Dryrun-Python

Dryrun-Python makes it very easy to run a python program without actual i/o operations. It can help you to fully focus on your business-logic without worrying about the i/o operation.

Key features

  • It supports async functions.
  • You can specify a return value.
  • Or, you can use mock function which is called instead of original function.

How to install

pip install dryrun
from dryrun import dryrun

How to use

Just import dryrun and use it as a decorator.

@dryrun()
async def delete_comment(comment_id: str) -> bool:
    response = await api_client.delete_comment(comment_id)
    return response.success

If dryrun is enabled, the real function won't be called.

And If you want to specify a return value, you can use return_value argument.

@dryrun(return_value=True)
async def delete_comment(comment_id: str) -> bool:
    response = await api_client.delete_comment(comment_id)
    return response.success

But it's not enough for some cases. Then, you can use mock function which is called instead of the real function.
Just like it!

@dryrun()
async def create_comment(payload: dict) -> dict:
    response = await api_client.create_comment(payload)
    return response.paylaod

@create_comment.mock
def create_comment_mock(payload: dict) -> dict:
    return {
        "id": uuid.uuid4(),
        "content": payload["content"],
    }

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

dryrun-1.0.1.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dryrun-1.0.1-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file dryrun-1.0.1.tar.gz.

File metadata

  • Download URL: dryrun-1.0.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.9

File hashes

Hashes for dryrun-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d1e1aee02181b39c6f88f94a0122b965f19d7a31291243a61b007580c8a1ead6
MD5 712a47fbd22fd6f4afa42513fd0353b5
BLAKE2b-256 e7deb7a2a31e8e9fd17f3072b212ec29c267117607b824cf4da00c57ef98fbe7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dryrun-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.9

File hashes

Hashes for dryrun-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 761299a4ae57d127599719986e6830e83fa62152b62308e801c0c573562b2bb6
MD5 5d765585675bb870c0a512696b33fb1c
BLAKE2b-256 cdf852f9b52ef446643be30e88270ab8a89d645c27733753d180bcd27f9f3450

See more details on using hashes here.

Supported by

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