Giter Site home page Giter Site logo

django-discoverage's People

Contributors

13rac1 avatar ryankask avatar thedrow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

thedrow noxan

django-discoverage's Issues

Avoid def lines in the miss statements

Regarding of coverage FAQ

Q: Why do the bodies of functions (or classes) show as executed, but the def lines do not?

This happens because coverage is started after the functions are defined. The definition lines are executed without coverage measurement, then coverage is started, then the function is called. This means the body is measured, but the definition of the function itself is not.

To fix this, start coverage earlier. If you use the command line to run your program with coverage, then your entire program will be monitored. If you are using the API, you need to call coverage.start() before importing the modules that define your functions.

I have not enough experience building unittest suites and discover-runner, I guess that build_suite do the imports of my tests but probably I'm wrong.

So, I tried:

def run_tests(self, test_labels, extra_tests=None, **kwargs):
    cov = coverage.coverage(omit=COVERAGE_OMIT_MODULES)
    cov.start()
    if self.no_coverage:
        # ....

but it doesn't work

What it works is start the coverage at module level

coverage.start()
class DiscoverageRunner(DiscoverRunner):

but I don't think is a good solution

For the purpose of this issue, I show my django_project/tests structure (only what is relevant)

# All folders inside project as python packages (Avoiding print *inits*)
project/
  manage.py
  libs/
    app/
      models.py
  app2/
    models.py
  tests/
    app/test_*.py
    app2/test_*.py

and unittest settings

...
INSTALLED_APPS = ('libs.app', 'app2', 'discoverage')
TEST_RUNNER = 'discoverage.DiscoverageRunner'
...

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.