All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
1answer
32 views

python test coverage comparison with previous run

I am using coverage.py to check the code coverage of my unit tests, in form of html report. coverage run -m pytest coverage html The report is pretty cool which shows the overall coverage % and the ...
0
votes
0answers
37 views

How to measure coverage in a proper way

Pytest + coverage are showing very strange coverage statistics. They are counting only those modules where tests were added, but other Python modules are not calculated for some reason. I have a ...
2
votes
0answers
42 views

How do I get coverage to recognize an exit error?

My goal is to reach 100% coverage on unit tests I'm writing (Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32) The code I'm testing has exit ...
0
votes
1answer
25 views

python coverage error during html report (NoSource: No source for code:)

I encounter the following error during reporting html coverage. myrepo>coverage report html html NoSource: No source for code: 'C:\Users\usr\AppData\Local\Programs\Python\Python37-32\Lib\html': [...
0
votes
1answer
117 views

coverage.py gives “No source for code”, despite .coveragerc seemingly telling it where the code is

If I invoke python3 -m coverage run ... inside a docker container, I get a .coverage file as desired. However, if I try to generate the html or text reports using that .coverage file outside of the ...
0
votes
0answers
32 views

Running Python coverage collection around a process that forks

I have a Python application I'm running within a Docker container. That application is normally started with the command /usr/local/bin/foo_service, which is a Python entry point (so it's just a ...
0
votes
2answers
43 views

Python Coverage - Analyze only project files

I'm using coverage module in python to check the code coverage. However, while running 'coverage report', the module is analyzing unwanted files shown below other than the project files. How can I ...
1
vote
0answers
41 views

How to get code coverage results of multiple files through a python script

I am having troubles using the coverage.py module in my python script. The scenario is: I have a script which calls upon test scripts and executes them as this was the only way to call multiple tests ...
0
votes
1answer
39 views

How can I run a thrift server or TCP server as a pytest fixture?

platform linux2, python 2.7.12-final-0 My integration tests ping an external server but I would like to change that to use a test fixture. I have been trying a few days to run a Thrift library TCP ...
0
votes
0answers
36 views

Coverage reports that python code executed by tests is not covered

Coverage is reported 0% coverage for modules executed by my tests. I have a multithreaded server with the following directory structure: /service /src /Models/* /Queries/* ...
0
votes
0answers
13 views

Nose tests with coverage missing concurrency code

I used to run coverage with option --concurrency to correctly cover concurrency code, like: $coverage --concurrency=eventlet run run_all_test.py But after I took apart the long single test script ...
2
votes
1answer
197 views

Run coverage on tests directory via Travis-CI

I am unable to run coverage.py in the tests directory from a Python project. I have a tests directory containing an __init__.py file and some test_*.py files where I define the tests I want to run in ...
0
votes
0answers
263 views

Coverage badge in Gitlab CI with Python coverage always unknown

I am trying to show a coverage badge for a Python project in a private Gitlab CE installation (v11.8.6), using coverage.py for Python. However, the badge always says unknown. This is the relevant job ...
1
vote
1answer
92 views

Python coverage not finding my own modules

My code executes correctly using python3, but using coverage3 returns an ImportError when importing a package I created. My project looks as follows: components/common/ConfigTest/ConfigTest.py -> ...
0
votes
0answers
128 views

Coverage “Pragma: No Cover” does not work for modules in sub folder

I am trying to add "Pragma: No Cover" to modules that do not require coverage. But coverage.py is only recognizing the comment in modules in the root folder. It does not work on modules that are ...
0
votes
1answer
38 views

Django/Python: how to know which tests cover a piece of code?

I know coverage python package is capable of creating reports (in html) that show if pieces of code are covered by tests, or not. I can also run just a single individual test, and know what does it ...
0
votes
0answers
27 views

Coverage.py does not include all files and folder specified

Line below is the part of my manage.py code cov = coverage.Coverage(branch=True, include="app/*" But when i run test with coverage i received coverage for only two files ...
0
votes
1answer
34 views

Disable coverage while running nosetests

I'm new to Python. I am new to PyCharm. I am trying to debug through my unit tests. They are done with nosetest. Currently, when I run my tests with the vagrant debugger, it gives me the following ...
0
votes
1answer
36 views

Ignore deprecated methods with python coverage testing

I am doing some coverage analyis on a code base that contains a fair amount of deprecated (using the deprecated package) methods. Most of these deprecated methods do not have any tests. So when doing ...
-1
votes
2answers
646 views

Test if __name__ == “__main__”: with click and pytest

I have the following code in test.py: import click @click.command() @click.option('--text', default='hello world', help='Text to display.') def say(text): print(text) if __name__ == "__main__":...
0
votes
0answers
126 views

How to measure code coverage for Flask application while it is running?

In python Coverage library is used to find code coverage. I've written simple flask application like this and embed code-coverage API it: from flask import Flask import coverage cov = coverage....
0
votes
1answer
14 views

Collating code files in multiple locations

I'm trying to use coverage.py on my unittest-based tests. I see that there are multiple kinds of paths and they're not collated, so the coverage data is wrong. /home/travis/virtualenv/python3.6.3/lib/...
3
votes
0answers
72 views

How to instruct coverage.py to omit top-level definitions and count only method's bodies?

I want to test the coverage of a single package within a large body of software (specifically an Odoo addon). I have no control over the overall setup of the test. Hacking Odoo to start the coverage ...
1
vote
1answer
48 views

Merge html coverage reports from two different frameworks generated from coverage.py

I have two different automation framework in python for my test cases Framework-1-is old and is going to be deprecated Framework-2-is New one with enhanced capabilities for time being i wanted to ...
0
votes
1answer
183 views

.coveragerc unable to locate files I want omitted

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/...
0
votes
0answers
20 views

Coverage detecting import statements as not covered [duplicate]

When testing a Django project with django_nose and coverage.py, the report says the import statements are not covered: Name Stmts Miss Cover Missing ----------------------------------...
1
vote
1answer
87 views

Coverage.py: How to append result for multiple python scripts getting called from shell script

I am having shell script which calls multiple python code with argument. Now my requirement is to collect the report for the whole project. Any idea how to run coverage.py on whole code and generate a ...
1
vote
0answers
101 views

How to get the coverage of behave testing?

I am using behave for BDD and am looking to get code coverage of behave. Here is my command I tried: coverage run --source='/app/code' -m behave The final output I am getting here is: Coverage.py ...
1
vote
1answer
270 views

Make coverage only count successful tests and ignore xfailing tests

I have a number of projects where I use the pytest.mark.xfail marker to mark tests that fail but shouldn't fail so that a failing test case can be added before the issue is fixed. I do not want to ...
0
votes
0answers
52 views

Tox+Python: WinError 5 Access denied (despite running as admin)

I'm getting crazy from this problem. I'm using Tox for testing my Python package and suddenly I started getting this error: When I try to recreate my tox environment (tox --recreate), it keeps ...
-1
votes
1answer
260 views

python coverage missing tests

I'm running python coverage but my coverage is not 100%. def add(a, b): return a + b test_utils.py from python_coverage import utils import unittest class TestAdd(unittest.TestCase): """ ...
1
vote
1answer
592 views

How to test a Python CLI program with click, coverage.py, and Tox?

I'm working on a CLI program using click, and I want to start adding some tests with code coverage analysis using coverage.py. I thought a good way to implement the tests would be to run the CLI ...
1
vote
1answer
57 views

Unbuffered python coverage

I want to run application in production with coverage enable. The application is always up and do not stop its execution. In each day I want to see coverage increase. Unfortunately .coverage file ...
2
votes
0answers
581 views

Python Coverage - not covering function contents, just definition

I am using coverage.py to test my code coverage. My tests are passing, however, when I call coverage run -- [script].py -m [test_script].py and generate a report it indicates that <line hits="...
1
vote
1answer
172 views

How to run a coverage report only on the functions changed in a PR?

I am working on an enormous django project that takes hours to generate a coverage report (using the coverage.py library). Instead, I want travis to generate a report on only the functions that have ...
1
vote
1answer
173 views

Python coverage does not see config file

I am running python coverage for Django unit tests in parallel mode: coverage run --source='.' --concurrency=multiprocessing manage.py test --parallel It is complaining: Options affecting ...
0
votes
1answer
381 views

How to omit (remove) virtual environment (venv) from python coverage unit testing?

https://coverage.readthedocs.io/en/coverage-4.5.1a/source.html#source My coverage is also including “venv” folder and I would like to exclude it no matter what I do even with --include or omit ...
0
votes
1answer
663 views

How can I make Python's coverage tool fail if any unit tests fail?

I want to use a shell script to make sure that my unit tests pass and that my code has sufficient test coverage. I only want to run my test code once. I was hoping that I could run my tests via the ...
0
votes
1answer
33 views

Is there a standard way to store test coverage results to compare them in time?

I have a Django project in which I can run coverage and create the report coverage run --source='.' manage.py test my_app I would like to compare the results over time after code refactors. Is ...
0
votes
0answers
296 views

coverage.xml is not being generated despite all tests are passing

I have been trying from long time to generate coverage for the tests i have written. First i tried the simple command :- coverage run pythontestfilename.py coverage xml -o coverage.xml This ...
0
votes
1answer
126 views

nose.plugins.cover: ERROR: Coverage not available: unable to import coverage module

When trying to compute coverage for a python project, I run into the following error: nose.plugins.xcover: ERROR: Coverage not available: unable to import coverage module This is the command I'm ...
2
votes
1answer
806 views

How can I combine coverage results with tox?

For my mpu package I have execution-environment dependend code like if sys.version_info < (3, 0): pass # do something else: pass # do something else and a tox file [tox] envlist = py27,...
6
votes
1answer
609 views

How to generate coverage report for http based integration tests?

I am writing integration tests for a project in which I am making HTTP calls and testing whether they were successful or not. Since I am not importing any module and not calling functions directly ...
2
votes
1answer
1k views

Django Coverage ModuleNotFoundError: No module named 'django_extensions'

I've dug through SO posts, I've dug through random obscure blogs and I can't seem to fix my issue here. This is how I went about all this: I created a nice fresh new virtual environment: virtualenv ...
0
votes
1answer
135 views

PyDev where to put .coveragerc

I want to exclude some abstract methods from code coverage and followed the suggestion of using an exception and a .coveragerc file as described here This method works fine, if I run coverage from ...
3
votes
0answers
308 views

Incremental code coverage for Python unit tests?

How can I get an incremental report on code coverage in Python? By "incremental", I mean what has been the change in the covered lines since some "last" report, or from a particular Git commit. I'm ...
0
votes
3answers
650 views

With coverage.py, how to skip coverage of import and def statements

I have a python program that imports other files which potentially import other files, as is normal with python development The problem is, when I measure coverage with coverage.py, some files which ...
2
votes
0answers
247 views

Codecov coverage report seems to erroneously omit __init__.py file

I'm using coverage and codecov to report coverage on my Github project via my Travis CI build. However, the online reports are unexpected in that they do not match the local reports in that the root ...
2
votes
4answers
929 views

“coverage run app.py” inside a docker container not creating .coverage file?

System Def: 2012 macbook pro running Sierra, Docker version: 17.12.0-ce-mac49 (21995) The Problem: I'm having an issue running my python app with "coverage run" in my container. I'm going to try ...
18
votes
1answer
635 views

Coverage of Cython module using py.test and coverage.py

I want to get coverage information of a Cython module using some (unit) tests written in Python. What I have right now is coverage of the tests themselves, i.e. which lines of the tests are executed ...