Commit b4824ad5 authored by Jérome Perrin's avatar Jérome Perrin

analyze: fix ZeroDivisionErrors when report is empty

parent 474a0559
......@@ -56,3 +56,18 @@ __main__.Object,56,1880,54.366686%,33.571429,9,303,47,1577
== captured.out
)
assert captured.err == ""
# empty range
report(
analyze(
os.path.join(os.path.dirname(__file__), "testdata", "1.fs"),
use_dbm=False,
delta_fs=False,
tidmin="ffffffffffffffff",
tidmax=None,
),
csv=False,
)
captured = capsys.readouterr()
assert "No transactions processed\n" == captured.out
assert captured.err == ""
......@@ -95,9 +95,10 @@ def report(rep, csv=False):
delta_fs = rep.delta_fs
if not csv:
if rep.TIDS == 0:
print "# ø"
else:
print "# %s..%s" % (ashex(rep.tidmin), ashex(rep.tidmax))
print "No transactions processed"
return
print "# %s..%s" % (ashex(rep.tidmin), ashex(rep.tidmax))
print "Processed %d records in %d transactions" % (rep.OIDS, rep.TIDS)
print "Average record size is %7.2f bytes" % (rep.DBYTES * 1.0 / rep.OIDS)
print ("Average transaction size is %7.2f bytes" %
......
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