Skip to main content

Give your application a break.

Project description

Sleep soundly. Sleep randomly.


The narcolepsy package contains code which alters the behavior of your application/api by injecting random sleep calls into its code paths.


The following code is an example of using the @narcoleptic decorator.

from narcolepsy import narcoleptic

@narcoleptic(max=5)  # sleep for 5 seconds at max
def foobar():
    for x in xrange(1024):


The easiest way to install narcolepsy is via pip:

$ pip install narcolepsy


Why not? There are probably testing applications that I haven’t considered where timing is an integral component to the execution environment. Or you could use this to make sneaking by CAPTCHAs a bit easier :D


See the LICENSE file for details.

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

narcolepsy-0.0.1.tar.gz (4.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page