ryankask / django-discoverage Goto Github PK
View Code? Open in Web Editor NEWCoverage reporting for django-discover-runner.
License: BSD 2-Clause "Simplified" License
Coverage reporting for django-discover-runner.
License: BSD 2-Clause "Simplified" License
There should be an option to activate and deactivate code coverage reports i.e. --no-coverage or --coverage.
What do you guys prefer?
It's pretty easy to implement.
This will help test Python 3 support.
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'
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.