Coder Social home page Coder Social logo

Measure branch coverage about pybuilder HOT 4 CLOSED

pybuilder avatar pybuilder commented on May 12, 2024
Measure branch coverage

from pybuilder.

Comments (4)

mriehl avatar mriehl commented on May 12, 2024

I added the branch parameter and branch coverage can be seen in the report, but the
analysis call to coverage still only gives me information about statement coverage.

('/tmp/test/src/main/python/foo/__init__.py', [1, 2, 3, 4, 5], [], '')

although

Name    Stmts   Miss Branch BrMiss  Cover   Missing
---------------------------------------------------
foo         5      0      4      2    78% 

Not sure what I can do here. I'm definitely not parsing the report from coverage in either XML or HTML form.
I think this is a problem with coverage itself.

from pybuilder.

nedbat avatar nedbat commented on May 12, 2024

It's true: the coverage API (methods on the coverage object itself) don't have a way to get the branch numbers. Frankly, I was a little surprised to see this, and that yours is the first request for it! Most people dig into the code to find the information, which is both a little unfortunate and your only option at the moment.

If you look at the code for coverage.analysis(), it calls coverage._analysis(), which creates an Analysis object. That object has a .numbers attribute with the stats you're looking for.

I'm on the verge of undertaking a major overhaul of coverage.py, I'll take this need into account.

from pybuilder.

mriehl avatar mriehl commented on May 12, 2024

Thanks @nedbat !
I can definitely work with this, but you're going to have to wait a bit longer @aelgru !

from pybuilder.

arcivanov avatar arcivanov commented on May 12, 2024

@mriehl

This is resolved by #160 (https://github.com/pybuilder/pybuilder/pull/153/files#diff-62a96813032655a36d7cf13b53e2cea5R92)

Still no branch coverage in JSON output, not sure if it's necessary though.

from pybuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.