mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 09:35:34 +00:00
Merge pull request #451 from neozenith/master
fix IndexError when empty cassette throws CannotOverwriteCassetteException
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,6 +6,7 @@ build/
|
|||||||
dist/
|
dist/
|
||||||
*.egg/
|
*.egg/
|
||||||
.coverage
|
.coverage
|
||||||
|
htmlcov/
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
pytestdebug.log
|
pytestdebug.log
|
||||||
|
|
||||||
|
|||||||
3
tox.ini
3
tox.ini
@@ -11,12 +11,13 @@ deps = flake8
|
|||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands =
|
commands =
|
||||||
./runtests.sh {posargs}
|
./runtests.sh --cov={envsitepackagesdir}/vcr --cov-branch {posargs}
|
||||||
deps =
|
deps =
|
||||||
Flask
|
Flask
|
||||||
mock
|
mock
|
||||||
pytest
|
pytest
|
||||||
pytest-httpbin
|
pytest-httpbin
|
||||||
|
pytest-cov
|
||||||
PyYAML
|
PyYAML
|
||||||
ipaddress
|
ipaddress
|
||||||
requests: requests>=2.22.0
|
requests: requests>=2.22.0
|
||||||
|
|||||||
@@ -311,6 +311,10 @@ class Cassette(object):
|
|||||||
best_matches.sort(key=lambda t: t[0], reverse=True)
|
best_matches.sort(key=lambda t: t[0], reverse=True)
|
||||||
# Get the first best matches (multiple if equal matches)
|
# Get the first best matches (multiple if equal matches)
|
||||||
final_best_matches = []
|
final_best_matches = []
|
||||||
|
|
||||||
|
if not best_matches:
|
||||||
|
return final_best_matches
|
||||||
|
|
||||||
previous_nb_success = best_matches[0][0]
|
previous_nb_success = best_matches[0][0]
|
||||||
for best_match in best_matches:
|
for best_match in best_matches:
|
||||||
nb_success = best_match[0]
|
nb_success = best_match[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user