code-coverage

Jenkins sudo: a terminal is required to read the password

Jenkins sudo: a terminal is required to read the password Question: I have a FastAPI app for which I have configured Jenkins pipeline. When I execute unit tests with the code coverage enabled they are failing with the following error : Started by user gold Obtained Jenkinsfile from git https://github.com/edtshuma/devsecops-labs.git [Pipeline] Start of Pipeline [Pipeline] …

Total answers: 2

pytest coverage 'if 0:' statement body not listed as a miss

pytest coverage 'if 0:' statement body not listed as a miss Question: Test marks the code as covered if the condition is 0 but as uncovered if the condition is a variable with value of zero. I was trying a simple thing in pytest with coverage and I found this bug (?). I am not …

Total answers: 1

Coverage "No source for code" with pytest

Coverage "No source for code" with pytest Question: I am trying to measure code coverage by my pytest tests. I tried following the quick start guide of coverage (https://coverage.readthedocs.io/en/6.4.1/) When I run my test with the following command, everything seems fine coverage run -m pytest tests/ ===================================== test session starts ====================================== platform linux — Python …

Total answers: 4

how to get which statements are missed in python test coverage

how to get which statements are missed in python test coverage Question: I am new to python, I have written test cases for my class , I am using python -m pytest –cov=azuread_api to get code coverage. I am getting coverage on the console as How do I get which lines are missed by test …

Total answers: 3

preventing python coverage from including virtual environment site packages

preventing python coverage from including virtual environment site packages Question: 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)- – – – …

Total answers: 4

Python coverage badges, how to get them?

Python coverage badges, how to get them? Question: I am using Python coverage to test my apps. Looking at other developers on GitHub I see they have a small badge which shows the percentage of coverage. Using coverage, how can I generate these badges? The coverage badge is the one I’m looking at below. Update: …

Total answers: 9

Python Code Coverage and Multiprocessing

Python Code Coverage and Multiprocessing Question: I use coveralls in combination with coverage.py to track python code coverage of my testing scripts. I use the following commands: coverage run –parallel-mode –source=mysource –omit=*/stuff/idont/need.py ./mysource/tests/run_all_tests.py coverage combine coveralls –verbose This works quite nicely with the exception of multiprocessing. Code executed by worker pools or child processes is …

Total answers: 3

combine python coverage files?

combine python coverage files? Question: 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 …

Total answers: 5