Skip to content

Commit

Permalink
Fixed issue caused by divide by zero when no transactions occur in th…
Browse files Browse the repository at this point in the history
…e tests
  • Loading branch information
mikeshultz committed Mar 12, 2019
1 parent 56d84a0 commit 9acf020
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions solidbyte/cli/test.py
Expand Up @@ -107,9 +107,10 @@ def main(parser_args):

print(tabulate(report_table, headers=['Function', 'Low', 'High', 'Avg']))
print("\nTotal transactions: {}".format(len(report.transactions)))
print("Total gas used: {}".format(report.total_gas))
print("Average gas per tx: {}".format(round(
report.total_gas / len(report.transactions)
)))
if len(report.transactions) > 0:
print("Total gas used: {}".format(report.total_gas))
print("Average gas per tx: {}".format(round(
report.total_gas / len(report.transactions)
)))

sys.exit(return_code)

0 comments on commit 9acf020

Please sign in to comment.