python-coverage

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-

Can python coverage module conditionally ignore lines in a unit test?

天大地大妈咪最大 提交于 2019-12-23 19:06:12
问题 Using nosetests and the coverage module, I would like coverage reports for code to reflect the version being tested. Consider this code: import sys if sys.version_info < (3,3): print('older version of python') When I test in python version 3.5, the print() shows up as untested. I'd like to have coverage ignore that line, but only when I'm testing using python version 3.3+ Is there a way to do something like # pragma: no cover on the print() statement only for when sys.version_info is not less

preventing python coverage from including virtual environment site packages

北城以北 提交于 2019-12-21 06:47:08
问题 I am new to coverage and ran into a strange problem. My coverage is taking my virtual environment site packages into account. Here is the output of the coverage run: coverage run test.py .................... ---------------------------------------------------------------------- Ran 20 tests in 0.060s OK (atcatalog)- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -jmfrank63@fullstack-audio-text-catalog:~/workspace (git master) [19:58:45] $ coverage report Name Stmts Miss

Can't get Coverage to work in PyDev, “File has no statistics”

你说的曾经没有我的故事 提交于 2019-12-13 16:15:32
问题 I can't get Coverage to work with PyDev. Every file I run shows up with: "File has no statistics." I'm following the instructions by checking 'Enable code coverage for new launches', and dragging the folder to analyze over to the Code Coverage window. I've successfully installed coverage. After that, I refreshed my Python Interpreter settings, where the coverage folder shows up automatically. I've also tried to add the coverage folder to my project's External Libraries. Didn't work either...

Jenkins build inside a docker container with generated reports

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 16:24:58
问题 I am new to Jenkins and Docker and even after some researches, I do not find the way to do these things. I want to : Execute pytest and python-coverage on my project inside a docker container. This should generate test and coverage reports Access the generated reports and read them with some Jenkins'plugin. When I try locally with Docker, it is working. I created a Dockerfile which creates a docker image with the libs needed and the source code inside it, then a script is called when the

Reporting cumulative coverage across multiple Python versions

筅森魡賤 提交于 2019-12-09 15:54:09
问题 I have code that runs conditionally depending on the current version of Python, because I'm supporting 2.6, 2.7, and 3.3 from the same package. I currently generate a coverage report like this, using the default version of Python: coverage run --source mypackage setup.py test coverage report -m coverage html This is useful but not ideal, as it only reports coverage on Python 2.7. Instead, I would like to generate a cumulative report of the test coverage across 2.6, 2.7, and 3.2. How do I

Python test discovery with doctests, coverage and parallelism

与世无争的帅哥 提交于 2019-12-07 00:22:58
问题 ... and a pony! No, seriously. I am looking for a way to organize tests that "just works". Most things do work, but not all pieces fit together. So here is what I want: Having tests automatically discovered. This includes doctests. Note that the sum of doctests must not appear as a single test. (i.e. not what py.test --doctest-modules does) Being able to run tests in parallel. (Something like py.test -n from xdist) Generating a coverage report. Make python setup.py test just work. My current

Integrating command-line generated python .coverage files with PyDev

半腔热情 提交于 2019-12-06 12:00:25
问题 My build environment is configured to compile, run and create coverage file at the command line (using Ned Batchelder coverage.py tool). I'm using Eclipse with PyDev as my editor, but for practical reasons, it's not possible/convenient for me to convert my whole build environment to Eclipse (and thus generate the coverage data directly from the IDE, as it's designed to do) PyDev seems to be using the same coverage tool (or something very similar to it) to generate its coverage information, so

combine python coverage files?

廉价感情. 提交于 2019-12-05 11:36:15
问题 I'm wondering if it's possible to combine coverage.xml files into 1 file to see global report in HTML output. I've got my unit/functional tests running as 1 command and integration tests as the second command. That means my coverage for unit/functional tests are overridden by unit tests . That would be great if I had some solution for that problem, mainly by combining those files into 1 file. 回答1: You can't combine .xml files, but you can combine the raw data files. Your workflow would look

Python test discovery with doctests, coverage and parallelism

我的未来我决定 提交于 2019-12-05 04:32:51
... and a pony! No, seriously. I am looking for a way to organize tests that "just works". Most things do work, but not all pieces fit together. So here is what I want: Having tests automatically discovered. This includes doctests. Note that the sum of doctests must not appear as a single test. (i.e. not what py.test --doctest-modules does) Being able to run tests in parallel. (Something like py.test -n from xdist) Generating a coverage report. Make python setup.py test just work. My current approach involves a tests directory and the load_tests protocol . All files contained are named like