diff --git a/.gitignore b/.gitignore index 0727b2f..30f7358 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ build/ dist/ *.egg/ .coverage +htmlcov/ *.egg-info/ pytestdebug.log diff --git a/tox.ini b/tox.ini index e4a4274..a55904b 100644 --- a/tox.ini +++ b/tox.ini @@ -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 diff --git a/vcr/cassette.py b/vcr/cassette.py index 70ed20e..742014b 100644 --- a/vcr/cassette.py +++ b/vcr/cassette.py @@ -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]