Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Record and replay httplib actions for testing.

Project Description

This (very experimental) library allows you to install replacement stubs for httplib methods which record interactions with remote servers, and then play them back. Because urllib depends on httplib functionality, replaylib will record and play back urllib interactions as well.

It is intended to allow streamlined tests for services which interact with remote services: e.g. payment processors, shipping APIs, etc. To use it, just:

  1. Run your test suite while recording with replaylib.
  2. On subsequent runs, play back from replaylib. Tests will run faster, and won’t require external services.

It is fully tested, with 100% line and branch coverage, and works well with all APIs we have tried it on “in the wild”.

Note Use at your own risk!

Installation

Simple as:

$ easy_install replaylib

Or if you prefer, download the source and then:

$ python setup.py build
$ python setup.py install

Example

>>> import replaylib
>>> import urllib
>>> replaylib.start_record()
# Do some stuff with urllib.
>>> urllib.urlopen('http://www.google.com')
>>> replaylib.stop_record('activity.pkl')
>>> replaylib.start_playback('activity.pkl')
# Won't actually make a request to google.com
>>> urllib.urlopen('http://www.google.com')
>>> replaylib.stop_playback()

Nose Plugin

ReplayLib also comes with a nose plugin to make recording and playing back the interactions used by your test suites even simpler:

$ nosetests --replaylib-record=test.pkl
$ nosetests --replaylib-playback=test.pkl

License

ReplayLib is released under the GNU General Public License (GPL). See the LICENSE file for full text of the license.

Release History

Release History

This version
History Node

0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
replaylib-0.1-py2.6.egg (21.6 kB) Copy SHA256 Checksum SHA256 2.6 Egg Jun 22, 2010
replaylib-0.1.tar.gz (20.6 kB) Copy SHA256 Checksum SHA256 Source Jun 22, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting