Record and replay httplib actions for testing.
Project description
- Version:
- 0.1
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:
Run your test suite while recording with replaylib.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file replaylib-0.1.tar.gz
.
File metadata
- Download URL: replaylib-0.1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d77b29d993233287c8c7c35d41a059c461bd841b4f83a509e85922f7ea27b02a |
|
MD5 | 0000000caafef38b4df4663171b1dba7 |
|
BLAKE2b-256 | aaa4da3c4f1f8a8fe582b222da9c3374ac0667fda0f0b36dff0e6100c960976f |
File details
Details for the file replaylib-0.1-py2.6.egg
.
File metadata
- Download URL: replaylib-0.1-py2.6.egg
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0664b00a84a18af14fa00698209afe68d818c3a0571f84d79795204913981c4f |
|
MD5 | 40f8be15e588c238c72f143320d68611 |
|
BLAKE2b-256 | db79b2899aec2781b5e847fc0a4b706c0f67ba21d735ec91405cd37ae34d41aa |