Commit 1defb776 authored by juga  's avatar juga
Browse files

Stop to require consensus path to be str

And catch exception.
This way the tests do not need to be modified to include a
consensus path.
parent 210fb238
......@@ -795,11 +795,10 @@ class V3BWFile(object):
def read_num_net_relays(consensus_path):
"""Read the number of relays in the Network from the cached consensus
file."""
assert isinstance(consensus_path, str)
num = None
try:
num = len(list(parse_file(consensus_path)))
except FileNotFoundError:
except (FileNotFoundError, AttributeError):
log.info("It is not possible to obtain statistics about the "
"percentage of measured relays because the cached "
"consensus file is not found.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment