Giter Site home page Giter Site logo

Comments (2)

guotin avatar guotin commented on August 27, 2024

I tried to replicate a similar situation and ran into a weird situation. If I have some similar code and run the coverage collection with pytest --cov=. --cov-context=test and check how the coverage report looks, I get this:

cov_problem

So no test is recorded for the return key because there is no context for that line. But if change the source code like you did, the testname gets recorded:

cov_problem2

I don't think I can come up with a fix for this with any pytest-cov flag. You can also check what kind of contexts your program has by setting

[html]
show_contexts = True

and checking the html report produced by coverage html

from pytest-rts.

guotin avatar guotin commented on August 27, 2024

Update: for my example, this seems to be python version specific. The above situation is with 3.6.6 and with 3.8.5 the testname is recorded for the line in both cases. I had pytest-cov 2.11.1 and coverage 5.5 during both.

from pytest-rts.

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.