diff --git a/CHANGELOG.md b/CHANGELOG.md index 20a3eb0c9..b17ff2315 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/eth-brownie/brownie) ### Fixed - Recursively kill all RPC child processes on exit ([#1200](https://github.com/eth-brownie/brownie/pull/1200)) - -### Fixed - Issue with testing reverted contracts not found in deployment map ([#1195](https://github.com/eth-brownie/brownie/pull/1195)) +- Fix issue with missing contracts in coverage report ([#1178](https://github.com/eth-brownie/brownie/pull/1178)) ## [1.16.0](https://github.com/eth-brownie/brownie/tree/v1.16.0) - 2021-08-08 ### Added diff --git a/brownie/test/output.py b/brownie/test/output.py index 5b68cb89a..f2a950357 100644 --- a/brownie/test/output.py +++ b/brownie/test/output.py @@ -223,11 +223,14 @@ def _split_by_fn(build, coverage_eval): def _split(coverage_eval, coverage_map, key): results = {} - for fn, map_ in coverage_map["statements"][key].items(): - results[fn] = [[i for i in map_ if int(i) in coverage_eval[0]], [], []] - for fn, map_ in coverage_map["branches"][key].items(): - results[fn][1] = [i for i in map_ if int(i) in coverage_eval[1]] - results[fn][2] = [i for i in map_ if int(i) in coverage_eval[2]] + branches = coverage_map["branches"][key] + statements = coverage_map["statements"][key] + for fn in branches.keys() & statements.keys(): + results[fn] = [ + [i for i in statements[fn] if int(i) in coverage_eval[0]], + [i for i in branches[fn] if int(i) in coverage_eval[1]], + [i for i in branches[fn] if int(i) in coverage_eval[2]], + ] return results @@ -235,7 +238,7 @@ def _statement_totals(coverage_eval, coverage_map, exclude_contracts): result = {} count, total = 0, 0 for path, fn in [(k, x) for k, v in coverage_eval.items() for x in v]: - if fn.split(".")[0] in exclude_contracts: + if fn.split(".")[0] in exclude_contracts or fn not in coverage_eval[path]: continue count += len(coverage_eval[path][fn][0]) total += len(coverage_map[path][fn]) @@ -249,7 +252,7 @@ def _branch_totals(coverage_eval, coverage_map, exclude_contracts): for path, fn in [(k, x) for k, v in coverage_map.items() for x in v]: if fn.split(".")[0] in exclude_contracts: continue - if path not in coverage_eval: + if path not in coverage_eval or fn not in coverage_eval[path]: true, false = 0, 0 else: true = len(coverage_eval[path][fn][2])