question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

brownie failing on coverage

See original GitHub issue

Environment information

  • brownie Version: 1.10.4
  • ganache-cli Version: 6.10.1
  • solc Version: 0.5.17
  • Python Version: 3.8.2
  • OS: Ubuntu 20.04.1 LTS

What was wrong?

brownie crashed on coverage

Please include information like:

  • I have run brownie tests --coverage
  • full output of the error you received
==================================================================================================== Coverage =====================================================================================================
  File "brownie/_cli/__main__.py", line 60, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "brownie/_cli/test.py", line 65, in main
    return_code = pytest.main(pytest_args, ["pytest-brownie"])
  File "_pytest/config/__init__.py", line 157, in main
    ret = config.hook.pytest_cmdline_main(
  File "pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "_pytest/main.py", line 289, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "_pytest/main.py", line 277, in wrap_session
    config.hook.pytest_sessionfinish(
  File "pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "_pytest/terminal.py", line 813, in pytest_sessionfinish
    self.config.hook.pytest_terminal_summary(
  File "pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "brownie/test/managers/runner.py", line 419, in pytest_terminal_summary
    super().pytest_terminal_summary(terminalreporter)
  File "brownie/test/managers/base.py", line 240, in pytest_terminal_summary
    for line in output._build_coverage_output(coverage_eval):
  File "brownie/test/output.py", line 121, in _build_coverage_output
    all_totals = [
  File "brownie/test/output.py", line 122, in <listcomp>
    (i, _get_totals(i._build, coverage_eval, exclude_contracts)) for i in get_loaded_projects()
  File "brownie/test/output.py", line 197, in _get_totals
    r["statements"], r["totals"]["statements"] = _statement_totals(
  File "brownie/test/output.py", line 237, in _statement_totals
    count += len(coverage_eval[path][fn][0])
KeyError: 0
Terminating local RPC client...

How can it be fixed?

I don’t know really. I am knew to python and brownie. It was working fine until number of tests grew

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
RomanHidencommented, Aug 25, 2020

@iamdefinitelyahuman no problem, I have build brownie out of your #730 issue fix-tempproject-coverage branch and apparently this solves problem for me as well. Thanks you.

0reactions
iamdefinitelyahumancommented, Aug 24, 2020

Sorry for the incredibly slow response, I’ve been really busy with work lately.

I managed to find an issue related to this (#730) but not yet 100% if it’s exactly what you’re facing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Coverage Evaluation — Brownie 1.19.2 documentation
Coverage is analyzed on a per-transaction basis, and the results are cached. If you repeat an identical transaction, Brownie will not analyze it...
Read more >
eth-brownie/community - Gitter
Hello, I have encountered the following problem: I used brownie init to create my directory and it worked fine but when I call...
Read more >
Unit Test & Coverage w/ Brownie (Pytest) - YouTube
Ethereum Smart Contract Programming tutorial with Solidity, featuring Brownie, Ganache, and 100% test coverage !In Part 4 of this series, ...
Read more >
An In-Depth Guide to Testing Ethereum Smart Contracts
For failing transactions, use the history object to obtain the recent TransactionReceipt and then examine it with Brownie's various debugging ...
Read more >
Setup brownie to run certain test in a specific network
I am using brownie to run tests and right now my project is using two networks, ... brownie test -s --coverage --network development....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found