diff --git a/docs/advanced.rst b/docs/advanced.rst index ed5aa084..9cdc36af 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -372,3 +372,16 @@ cassette names, use ``VCR.ensure_suffix`` as follows: @my_vcr.use_cassette def my_test_function(): + +Rewind Cassette +--------------- + +VCR.py allows to rewind a cassette in order to replay it inside the same function/test. + +.. code:: python + + with vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml') as cass: + response = urllib2.urlopen('http://www.zombo.com/').read() + assert cass.all_played + a.rewind() + assert not cass.all_played diff --git a/docs/changelog.rst b/docs/changelog.rst index 42ea4eb3..5807d827 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,7 +1,17 @@ Changelog --------- -- 2.0.2 (UNRELEASED) - Drop support to python 3.4 +- 2.1.1 (UNRELEASED) +- 2.1.0 - Add a `rewind` method to reset a cassette (thanks @khamidou) + New error message with more details on why the cassette failed to play a request (thanks @arthurHamon2, @neozenith) + Handle connect tunnel URI (thanks @jeking3) + Add code coverage to the project (thanks @neozenith) + Drop support to python 3.4 + Add deprecation warning on python 2.7, next major release will drop python 2.7 support Fix build problems on requests tests (thanks to @dunossauro) + Fix matching on 'body' failing when Unicode symbols are present in them (thanks @valgur) + Fix bugs on aiohttp integration (thanks @graingert, @steinnes, @stj, @lamenezes, @lmazuel) + Fix Biopython incompatibility (thanks @rishab121) + Fix Boto3 integration (thanks @1oglop1, @arthurHamon2) - 2.0.1 - Fix bug when using vcrpy with python 3.4 - 2.0.0 - Support python 3.7 (fix httplib2 and urllib2, thanks @felixonmars) [#356] Fixes `before_record_response` so the original response isn't changed (thanks @kgraves) diff --git a/docs/debugging.rst b/docs/debugging.rst index abc23a2a..f7e8543d 100644 --- a/docs/debugging.rst +++ b/docs/debugging.rst @@ -29,3 +29,29 @@ The second time, you will see:: If you set the loglevel to DEBUG, you will also get information about which matchers didn't match. This can help you with debugging custom matchers. + +CannotOverwriteExistingCassetteException +======================================== + +When a request failed to be found in an existing cassette, +VCR.py tries to get the request(s) that may be similar to the one being searched. +The goal is to see which matcher(s) failed and understand what part of the failed request may have changed. +It can return multiple similar requests with : + +- the matchers that have succeeded +- the matchers that have failed +- for each failed matchers, why it has failed with an assertion message + +CannotOverwriteExistingCassetteException message example : + +.. code:: python + + CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('cassette.yaml') in your current record mode ('once'). + No match for the request () was found. + Found 1 similar requests with 1 different matchers : + + 1 - (). + Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path'] + Matchers failed : + query - assertion failure : + [('alt', 'json'), ('maxResults', '200')] != [('alt', 'json'), ('maxResults', '500')] \ No newline at end of file