Skip to main content

All 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 &...
Austin's user avatar
  • 51
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 ...
Reza Shakeri's user avatar
-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)...
Robo Jumble's user avatar
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 ./...
domke89's user avatar
  • 61
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='.' ...
shayms8's user avatar
  • 741
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 ...
intmain's user avatar
  • 21
-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 {}...
Thanh Nguyen's user avatar
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....
figbar's user avatar
  • 764
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 ...
wim's user avatar
  • 355k
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 ...
PythonUser's user avatar
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 ...
Pravin's user avatar
  • 687
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....
drmaa's user avatar
  • 3,576
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="...
Sinead McAleer's user avatar
-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 ...
AntoineLB's user avatar
  • 482
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 ...
Jonathan DEKHTIAR's user avatar

15 30 50 per page