1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

Merge pull request #451 from neozenith/master

fix IndexError when empty cassette throws CannotOverwriteCassetteException
This commit is contained in:
Arthur Hamon
2019-07-25 08:11:01 +02:00
committed by GitHub
3 changed files with 7 additions and 1 deletions

1
.gitignore vendored
View File

@@ -6,6 +6,7 @@ build/
dist/
*.egg/
.coverage
htmlcov/
*.egg-info/
pytestdebug.log

View File

@@ -11,12 +11,13 @@ deps = flake8
[testenv]
commands =
./runtests.sh {posargs}
./runtests.sh --cov={envsitepackagesdir}/vcr --cov-branch {posargs}
deps =
Flask
mock
pytest
pytest-httpbin
pytest-cov
PyYAML
ipaddress
requests: requests>=2.22.0

View File

@@ -311,6 +311,10 @@ class Cassette(object):
best_matches.sort(key=lambda t: t[0], reverse=True)
# Get the first best matches (multiple if equal matches)
final_best_matches = []
if not best_matches:
return final_best_matches
previous_nb_success = best_matches[0][0]
for best_match in best_matches:
nb_success = best_match[0]