mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
Update docs a little bit
This commit is contained in:
23
README.md
23
README.md
@@ -3,13 +3,32 @@
|
|||||||
This is a proof-of-concept start at a python version of [Ruby's VCR
|
This is a proof-of-concept start at a python version of [Ruby's VCR
|
||||||
library](https://github.com/myronmarston/vcr).
|
library](https://github.com/myronmarston/vcr).
|
||||||
|
|
||||||
#What it is supposed to do
|
##What it is supposed to do
|
||||||
Simplify testing by recording all HTTP interactions and saving them to
|
Simplify testing by recording all HTTP interactions and saving them to
|
||||||
"cassette" files, which are just yaml files. Then when you run your tests
|
"cassette" files, which are just yaml files. Then when you run your tests
|
||||||
again, they all just hit the text files instead of the internet. This speeds up
|
again, they all just hit the text files instead of the internet. This speeds up
|
||||||
your tests and lets you work offline.
|
your tests and lets you work offline.
|
||||||
|
|
||||||
#Similar libraries in Python
|
##Compatibility Notes
|
||||||
|
Currently I've only tested this (a little bit) with urllib2. It's known to *NOT
|
||||||
|
WORK* with urllib.
|
||||||
|
|
||||||
|
##How to use it
|
||||||
|
```python
|
||||||
|
import vcr
|
||||||
|
import urllib2
|
||||||
|
|
||||||
|
with vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml'):
|
||||||
|
response = urllib2.urlopen('http://www.iana.org/domains/example/').read()
|
||||||
|
assert 'Example Domains' in response
|
||||||
|
```
|
||||||
|
|
||||||
|
##Ruby VCR compatibility
|
||||||
|
I'm not trying to match the format of the YAML files. Cassettes generated by
|
||||||
|
Ruby's VCR are not compatible with VCR.py. The API is similar but I don't have
|
||||||
|
nearly as many features
|
||||||
|
|
||||||
|
##Similar libraries in Python
|
||||||
Neither of these really implement the API I want, but I have cribbed some code
|
Neither of these really implement the API I want, but I have cribbed some code
|
||||||
from them.
|
from them.
|
||||||
* https://github.com/bbangert/Dalton
|
* https://github.com/bbangert/Dalton
|
||||||
|
|||||||
Reference in New Issue
Block a user