Skip to main content

fake time.sleep() for use in tests

Project description

fakesleep is a simple module for tests that use time.sleep(). Sleeping in tests is generally considered bad (as it makes tests run slow). Using sleep with time.time() can lead to spurious failures, as clock precision / interpeter overhead can cause small differences in reported times.

But sometimes, you need sleep().

fakesleep provides a fake implementation of time.sleep() that doesn’t actually sleep. It also guarrantees “correct” results for calls to time.time() and other time functions. Note that datetime functions are not faked.

To install, simply call fakesleep.monkey_patch(). To restore the real versions, call fakesleep.monkey_restore().

author:

Pete Fein <pete@wearpants.org>

license:

BSD

versions:

Python 2.7 & 3

source:

https://github.com/wearpants/fakesleep

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

fakesleep-0.1.tar.gz (8.2 kB view details)

Uploaded Source

File details

Details for the file fakesleep-0.1.tar.gz.

File metadata

  • Download URL: fakesleep-0.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for fakesleep-0.1.tar.gz
Algorithm Hash digest
SHA256 c577e2183207bf5f509b4f06100cd4722660300f9953e396d730727937bdfc41
MD5 1f18e03697894ec8fc3b1712341229f6
BLAKE2b-256 df91e0036831c41ceb08a7c7887b9da348acf66b85d00d91227dab18bb51f56a

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