Skip to main content

Questions tagged [coverage.py]

coverage.py is a tool for measuring test code coverage of Python programs

coverage.py
0 votes
1 answer
18 views

no-data-collected when running tests with tox but not when running tests with pytest

I'm using tox to run unit tests with pytest. When I run the tests with tox, it runs the tests and shows the tree of my src directory but prints CoverageWarning: No data was collected. (no-data-...
user1445709's user avatar
0 votes
0 answers
22 views

Error while running coverage run because of os.environ in python

My code is importing several variables using os.environ. When I run 'coverage run' command for testing, it gives key error. Is there a way to provide env files to read env variables from there, or ...
Rishi's user avatar
  • 124
0 votes
1 answer
27 views

How to log coverage report to logs or summary?

I have a workflow that looks like this: on: push: branches: - master jobs: git_pull: runs-on: self-hosted steps: - name: executing remote ssh commands uses: appleboy/...
Yee Bee's user avatar
0 votes
0 answers
29 views

Trying to show pytest and coverage results on every sync using DevSpace

The issue I'm running into is that if all tests pass, nothing is displayed even coverage. I'd like to always see the results of both pytest and coverage when container updates. I have the following in ...
cheslijones's user avatar
  • 9,026
0 votes
0 answers
24 views

Why 'coverage' considers all of my class-based-views as tested?

I'm just learning django testing. When I use 'Coverage' module to check which parts of my code is tested, it considers almost all of class-based-views as tested while I have commented out all of my ...
mohsenof's user avatar
  • 109
0 votes
1 answer
105 views

Running Coverage in Jupyter Notebook

I am trying to generate a sample coverage.py report in Jupyter Notebook. Using API, I have managed to run this code: ! pip install coverage import coverage import unittest # Define very basic test ...
Dawid Pura's user avatar
  • 1,001
0 votes
1 answer
27 views

"... && coverage report" not working after switching to pytest-django

I was using unittest in Django to write tests and running the tests with this command: coverage run --omit='src/manage.py,src/config/*,*/.venv/*,*/*__init__.py,*/tests.py,*/admin.py' src/manage.py ...
cheslijones's user avatar
  • 9,026
0 votes
0 answers
60 views

Pytest coverage is not working with Python3.9, error out, no module named '_sqlite3'

I am trying to run pytest with coverage option (i.e. --cov) with python 3.9, it is not working, but when I run on Python 3.6 or 3.7 version it works. python -m pytest --cov=my_package --cov-report=xml ...
yuvraj's user avatar
  • 177
0 votes
1 answer
60 views

Coverage's dynamic context usage returns 'no contexts were measured'

I'm interested in seeing what test triggers what code via the coverage tool. I followed the instruction https://coverage.readthedocs.io/en/latest/contexts.html#dynamic-contexts, to enable dynamic ...
Xiaoxuan Jin's user avatar
0 votes
1 answer
202 views

Pytest reports missing lines in coverage for imports and constant assignments

I'm baffled by differences in coverage behavior for different files in my project and hope someone will please suggest how to debug this more effectively than I am doing now. This is basically the ...
chrisinmtown's user avatar
  • 4,128
0 votes
0 answers
15 views

How do I filter coverage for only the relevant files/dependencies (including 3rd party dependencies)?

I want to have a coverage report for dependencies that maybe 3rd party. It seems like that I need to point --source to the 3rd party dependencies directory (under venv site-packages) or else it will ...
Xiaoxuan Jin's user avatar
10 votes
1 answer
2k views

Azure PublishCodeCoverageResults@2 issue with detailed report for coverage

I'm trying to switch PublishCodeCoverageResults from @1 to @2. Because appeared warnig in pipeline ##[warning]New V2 version of task publishing code coverage results is available to all our customers ...
Eugene's user avatar
  • 101
0 votes
1 answer
22 views

Limit coverage report to only listing which methods/functions were never called

Is there a way to have coverage only list functions that never get called? This is more to prune dead code than to enhance unit tests. For example, given the following test.py, we can see that c will ...
JL Peyret's user avatar
  • 11.7k
2 votes
1 answer
156 views

Coverage of process spawned by pytest

I am trying to get coverage on a Python process spawned by pytest. Here are the steps I took: Create a sitecustomize.py module in my local site packages directory #/home/Olumide/.local/lib/python3....
Olumide's user avatar
  • 5,717
0 votes
0 answers
75 views

run coverage.py with pyspark udf

I'm trying to run pyspark UDF and measure code coverage within UDF itself. Although this is not fully operational, I've uncovered something that might provide insight into how to make it work. I'm ...
amit's user avatar
  • 71

15 30 50 per page
1
2 3 4 5
33