Skip to content
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 report is not consistent #1964

Open
pandadefi opened this issue Mar 14, 2024 · 4 comments
Open

Coverage report is not consistent #1964

pandadefi opened this issue Mar 14, 2024 · 4 comments
Labels
category: bug Something isn't working

Comments

@pandadefi
Copy link
Contributor

Environment information

  • OS: macOS
  • Python Version: 3.10.12
  • ape and plugin versions: 0.7.11
$ ape --version
0.7.11

$ ape plugins list
  etherscan    0.7.2
  foundry      0.7.4
  vyper        0.7.0
  • Contents of your ape-config.yaml (NOTE: do not post anything private like RPC urls or secrets!):
$ cat ape-config.yaml

name: XXX
plugins:
  - name: vyper
  - name: foundry
  - name: etherscan
ethereum:
  default_network: mainnet-fork
  mainnet_fork:
    default_provider: foundry
geth:
  ethereum:
    mainnet:
      uri: http://localhost:8540

test:
  coverage:
    reports:
      terminal: False 
      xml: True
      html: True

What went wrong?

Please include information like:

When running ape test --coverage the coverage report displayed several inconsistencies.
Some lines that were sandwiched between two lines that were covered were not. After looking at the XML file some more inconsistencies were found. The two lines above and beyond the not-covered one displayed a different number of hits.

            <line number="155" hits="8"/>
            <line number="156" hits="0"/>
            <line number="157" hits="2"/>
Screenshot 2024-03-14 at 13 11 24

I have also noticed that some of the natspec code is considered part of the code that needs tests and will appear in the XML report with zero hits.
Screenshot 2024-03-14 at 13 35 50

While I was looking at the XML report, I made a small tool to compile the XML into a more readable HTML file that might help you while fixing this issue, it can be found here

The node used to test was a neithermind node.

@pandadefi pandadefi added the category: bug Something isn't working label Mar 14, 2024
Copy link

linear bot commented Mar 14, 2024

@fubuloubu
Copy link
Member

I'm curious if there's no hits because there's no branch logic in that statement

@antazoey
Copy link
Member

What repo is this?

@pandadefi
Copy link
Contributor Author

What repo is this?

https://github.com/1uptokyo/1upyfi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants