coverage.py

How do I interpret Python coverage.py branch coverage results?

霸气de小男生 提交于 2020-04-12 10:01:36
问题 I'm using coverage.py to measure the code coverage of my tests. I've enabled branch coverage, but I can't quite make sense of the report. Without branch coverage, I get 100% coverage: Name Stmts Miss Cover Missing ------------------------------------------------------------ mylib/queries.py 44 0 100% With branch coverage enabled: Name Stmts Miss Branch BrPart Cover Missing -------------------------------------------------------------------------- mylib/queries.py 44 1 20 3 94% 55, 21->10, 53-

.coveragerc unable to locate files I want omitted

走远了吗. 提交于 2020-04-11 12:25:28
问题 I am using tox to automatically run my tests using pytest and pytest-cov plugin. However, I'm getting coverage reports for the files I omitted in .coveragerc : (env) alex@smartalex-pc:~/.repos/codelib/github/project$ tox [...] ../../../tests/test_module1.py::test_func PASSED [ 3%] [...] ../../../tests/test_module2.py::test_func PASSED [100%] ----------- coverage: platform linux, python 3.6.7-final-0 ----------- Name Stmts Miss Cover ------------------------------------------------------------

Coverage.py warning: No data was collected. (no-data-collected)

佐手、 提交于 2020-04-04 10:37:27
问题 I am trying to find the coverage using coverage module for a django project but gets "Coverage.py warning: No data was collected. (no-data-collected)". My project folder has src and tests folders. When I run coverage run -m pytest && coverage report It produces a report with 100% coverage with the list of files inside the tests folder. Whereas when I run coverage run --source=src -m pytest && coverage report it says Coverage.py warning: No data was collected. (no-data-collected) No data to

Show the differences in two test-coverage runs

北慕城南 提交于 2020-02-08 10:14:31
问题 I'm in the process of writing tests for some old and disowned code. I've found coverage.py to be a useful tool in helping me decide which test to write next. As I improve our testing I'd like to see how I've affected our coverage. Currently I'm doing this by bringing up the html report twice, in side-by-side browser windows, and visually looking for differences. This seems very crude. Do any of you have a better solution? I found z3c.coverage, and after struggling to get zope-testrunner

In Ant, how do I specify files with comma in filename?

╄→гoц情女王★ 提交于 2020-01-24 20:44:27
问题 Here is an example-target that I tried. Turns out, it wants to delete everything because the comma separates " * */*" and "cover" -- understandable. <target name="clean"> <delete verbose="true"> <fileset dir="." includes="**/*.pyo"></fileset> <fileset dir="." includes="**/*,cover"></fileset> </delete> </target> How do I specify an embedded comma? I'm trying to learn Ant so I won't have to maintain different build-systems for different operating-systems. In this case, it's in a Python

How to get coverage data from a django app when running in gunicorn

别等时光非礼了梦想. 提交于 2020-01-19 07:54:28
问题 How do I get code coverage out of a Django project's view code (and code called by view code)? coverage gunicorn <params> does not show any lines being hit. 回答1: coverage gunicorn <params> does not work, because gunicorn creates worker processes, and the coverage module can't work across forks (basically, creation of new processes). You can use the coverage API, though, for example in the python module that contains your WSGI application: # wsgi_with_coverage.py import atexit import sys

Why are most of my project's Django files missing from the PyTest Coverage report?

霸气de小男生 提交于 2020-01-16 16:47:40
问题 I'm running pytest-cov and pytest-django using tox . I have a very simple tox.ini file with limited omit files. The problem is when I run pytest using tox -e unit , I get a limited Coverage report: ---------- coverage: platform darwin, python 3.7.4-final-0 ----------- Name Stmts Miss Cover Missing ---------------------------------------------------------------------------- components/__init__.py 0 0 100% components/client/__init__.py 0 0 100% components/client/admin.py 27 0 100% components

Coveralls: Error- No source for in my application using Docker container

∥☆過路亽.° 提交于 2020-01-16 09:43:28
问题 I've been trying to integrate code-coverage in my Django application.. The build is successfull and all the tests are successfull but when i check coveralls.io or codecov.io there is no data.. I have searched everything, added a .coveragerc but still nothing helps. Dockerfile FROM python:3.7-alpine MAINTAINER abhie-lp ENV PYTHONUNBUFFERED 1 COPY ./requirements.txt /requirements.txt RUN apk add --update --no-cache jpeg-dev RUN apk add --update --no-cache --virtual .tmp-build-deps \ gcc libc

Disabling nose coverage report to STDOUT when HTML report is enabled?

假装没事ソ 提交于 2020-01-12 14:10:31
问题 I'm using nose (via django-nose) with the coverage plugin to check test coverage of my Django project. I've configured nose to generate an HTML coverage report on every test run: NOSE_ARGS = [ '--with-coverage', '--cover-package=foot', '--cover-html', '--cover-html-dir=cover', ] Now, I want to disable the plain-text coverage report that gets shown after every test run; the HTML is much more functional, and the long badly-formatted table makes it hard to see actual test output. Neither

Disabling nose coverage report to STDOUT when HTML report is enabled?

守給你的承諾、 提交于 2020-01-12 14:10:12
问题 I'm using nose (via django-nose) with the coverage plugin to check test coverage of my Django project. I've configured nose to generate an HTML coverage report on every test run: NOSE_ARGS = [ '--with-coverage', '--cover-package=foot', '--cover-html', '--cover-html-dir=cover', ] Now, I want to disable the plain-text coverage report that gets shown after every test run; the HTML is much more functional, and the long badly-formatted table makes it hard to see actual test output. Neither