New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coverage reports do not cover all contracts #1087
Comments
I found this issue to be quite random. Sometimes the coverages covers all my contracts, but more often than not, it covers only a small subset of the contracts tested, sometimes none. |
Same issue here with:
I've got coverage for the fist contract I deploy. |
Same problem here. I've noticed that when using solc 0.8.3 I get a normal coverage report, but with 0.8.4 it comes back empty. |
I found, that it happens with contracts that use the
as mentioned in the docs here. But I'm not sure that it's the only reason which causes such behavior. |
…sing statements or branches The previous behavior expects all functions to have a report for both statements and branches. If not, it removes the whole contract from the coverage report. While the assumption seems reasonable, some functions seem to only have either one of statements or branches, ending up in removing contracts that would otherwise contain useful coverage information. This is related to eth-brownie#1087 and should at least be a partial fix to it
…sing statements or branches The previous behavior expects all functions to have a report for both statements and branches. If not, it removes the whole contract from the coverage report. While the assumption seems reasonable, some functions seem to only have either one of statements or branches, ending up in removing contracts that would otherwise contain useful coverage information. This is related to eth-brownie#1087 and should at least be a partial fix to it
…sing statements or branches The previous behavior expects all functions to have a report for both statements and branches. If not, it removes the whole contract from the coverage report. While the assumption seems reasonable, some functions seem to only have either one of statements or branches, ending up in removing contracts that would otherwise contain useful coverage information. This is related to eth-brownie#1087 and should at least be a partial fix to it
…sing statements or branches The previous behavior expects all functions to have a report for both statements and branches. If not, it removes the whole contract from the coverage report. While the assumption seems reasonable, some functions seem to only have either one of statements or branches, ending up in removing contracts that would otherwise contain useful coverage information. This is related to eth-brownie#1087 and should at least be a partial fix to it
…sing statements or branches The previous behavior expects all functions to have a report for both statements and branches. If not, it removes the whole contract from the coverage report. While the assumption seems reasonable, some functions seem to only have either one of statements or branches, ending up in removing contracts that would otherwise contain useful coverage information. This is related to eth-brownie#1087 and should at least be a partial fix to it
…sing statements or branches The previous behavior expects all functions to have a report for both statements and branches. If not, it removes the whole contract from the coverage report. While the assumption seems reasonable, some functions seem to only have either one of statements or branches, ending up in removing contracts that would otherwise contain useful coverage information. This is related to eth-brownie#1087 and should at least be a partial fix to it
This bug is still active? |
Yes, the bug is still active |
I'm having the same issue. I'm using two contracts, and while they both show up in the coverage, it doesn't show all the functions in the contracts. |
still having the same issue 😢 |
I ran into the same issue using Brownie v1.18.1. What @Psirex wrote seems to be the only problem. I have some contracts where only one state variable is set to As soon I remove |
Actually I was wrong. I had been playing with it a bit more and realized that something seems to be broken. I tried it with an example project: |
I spend some time looking into why the I was able to see that there seems to be an issue in the If I saw it correct, brownie takes the local compiled files, execute the tests, and trace based on the opcodes. But there is the following try-except block: try:
pc = last["pc_map"][trace[i]["pc"]]
except (KeyError, TypeError):
# we don't have enough information about this contract
continue I was wondering why but I believe that the difference is the bytecode. pragma solidity ^0.8.12;
contract Contract1 {
uint private i1;
constructor(uint _i1){
i1=_i1;
}
function getValue() public view returns (uint) {
return i1;
}
} You will be able to get the bytecode from the compiler.
the bytecode deployed as contract differs from the one you get from the Solidity compiler. If I am wrong about it, let me know :) Hope it might help the next dev to go deeper. |
Environment information
brownie
Version: 1.14.6solc
Version: 8.0.0What was wrong?
Please include information like:
I have 3 contracts that work in interaction with each others.
My testing script is on one file.
When I run
brownie test --coverage
I get a coverage report for only one of the contracts. I'd like to get it for all of the contracts.The text was updated successfully, but these errors were encountered: