All Questions
43
questions
1
vote
1
answer
49
views
Increasing test coverage for files I didn't write
I have written a python program that calculates various statistical values of a given list of integers and the range of values. Now, I am trying to write a test file for the program that can achieve &...
0
votes
1
answer
65
views
how test a value in try except block with pytest and coverage in django setting?
I would like to test a Try/Except block, but I try any method Coverage that says that part is not tested. My goal is to test the Error_Message from the user's django settings, and if the user did not ...
-1
votes
1
answer
269
views
How many test cases would I need to test all branches?
The test method is the following:
def testArrayLength(array):# array passed through
length = len(array); # get number of chars in the container
if(length > 20):
return 1
if(length > 1)...
4
votes
0
answers
369
views
Generate a single report from multiple test stages in .gitlab-ci.yml
If there exist multiple test scripts in a .gitlab-ci.yml file, for example:
.run_warehouse_tests: &run_warehouse_tests |
echo "Running tests for Warehouse"
python -m pytest --durations=0 ./...
0
votes
1
answer
876
views
python coverage - specify the working directory
I have a django application called edison with multiple django-apps in it. I run tests on them using coverage:
coverage run --source='.' edison/manage.py test application_one
coverage run --source='.' ...
2
votes
1
answer
661
views
How to measure test coverage of app on python if application and tests in different projects
I want to measure coverage in my project by integration tests (integration of several microservices). Applications - python, tests - pytest.
I know about pytest-cov, but the problem is that my ...
-1
votes
1
answer
515
views
what does {} and format do in this command python? [duplicate]
Hi i am reading a source and it has a line:
fn = 'total-listmix-{}-{}.xml'.format(opt.os, opt.compiler)
exept Exception as e:
raise Exception('error merging coverage: {}'.format(e))
I think the {}...
1
vote
0
answers
140
views
Codecov only runs tests listed last in .travis.yml
I am using Travis CI and Codecov with my Django project, and using the coverage package to generate coverage reports. The project has two apps, app1 and app2, each with their own tests.py. My .travis....
1
vote
2
answers
2k
views
How to find code which was never executed in coverage.py despite a 100% coverage report
Consider the following code:
import math
def dumb_sqrt(x):
result = math.sqrt(x) if x >= 0 else math.sqrt(-x)*j
return result
def test_dumb_sqrt():
assert dumb_sqrt(9.) == 3.
The ...
1
vote
0
answers
387
views
Getting incorrect coverage report for no matter what module we are executing on multiprocess product
We have a product with multiple python scripts which executes as different processes, sub-processes, daemons and on apache using mod-wsgi. The product runs on top of debian 9 and the scripts are ...
1
vote
1
answer
314
views
Skipping files from coverage
I have a very different requirement to exclude some files from test coverage.
I have a few files which are meant to work on Linux and not on Mac OS X and based on the underline platform I either run ...
0
votes
1
answer
59
views
How to find a specific matrix by generating random matrix
I am trying to increase coverage of my test by making a test case which will be checking the if condition of s matrix in the following program. I dont know what matrix I pass to the function np.linalg....
5
votes
1
answer
4k
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="...
-2
votes
1
answer
1k
views
Python : is coverage using skipped test
Here is a test :
@skip("my test is skipped")
def test_coverage():
my_function()
My question is simple :
If i run my coverage, will my_function will be covered or not (considering my test is ...
3
votes
1
answer
1k
views
How to set coveragerc and/or setup.cfg to test a package with specific tests location
I am implementing tests on a python package and I try to make them with pytest.
The project has the following architecture:
package_name/
__init__.py
file1.py
file2.py
...
tests/
test_file1.py
...