Category : code-coverage

I have the following project structure: v/b.py v/e.py v/e_test.py v/p.py v/__init__.py #v/e.py from b import B from p import P class E(object): def run(self): pass #v/p.py class P(object): def run(self): pass #v/b.py from p import P class B(object): def run(self): pass #v/e_test.py from e import E import unittest class ETest(unittest.Testcase): def testSomething(self): pass if __name__ ..

Read more

I have a view on my Django app with the tag @login_required: @login_required @require_http_methods([‘GET’, ‘POST’]) def edit_result(request: WSGIRequest, result_id: str): try: result_type, result_number = EditResultService.split_result_id(result_id.lower()) except Error as e: messages.error(request, str(e)) return render(request, PAGE404_TEMPLATE) if request.POST: EditResultService.post_request(request, result_type, result_number) context = EditResultService.get_request(result_type, result_number) if context: return render(request, ‘edit_result.html’, context) else: return render(request, PAGE404_TEMPLATE) I am ..

Read more

I am trying to generate coverage reports for my python code from jenkins pipeline. But somehow coverage command is not running. Have tried different options but no luck. below is sample of my jenkins file where I am trying to run these commands. dir(lambda){ if(fileExists("requirements.txt")) { // Use pip to install dependencies (via Artifactory) sh(returnStdout: ..

Read more

I am trying to pblish code coverage results on the pipeline run summary page. This is my pipeline.yaml file: – bash: | pip install .[test] pip install pytest pytest-azurepipelines pytest-cov pytest –junitxml=junit.xml –cov=./src_dir –cov-report=xml –cov-report=html tests displayName: Test – task: [email protected] inputs: codeCoverageTool: Cobertura summaryFileLocation: ‘$(System.DefaultWorkingDirectory)/**/coverage.xml’ reportDirectory: ‘$(System.DefaultWorkingDirectory)/**/htmlcov’ The coverage report keeps showing 0% always ..

Read more

Here’s what I run, and what I get: me $ pytest –cov MakeInfo.py ================================================================================ test session starts ================================================================================= platform darwin — Python 3.7.4, pytest-6.2.5, py-1.10.0, pluggy-0.13.0 rootdir: /Users/me/Documents/workspace-vsc/Pipeline/src/python plugins: cov-2.12.1, arraydiff-0.3, remotedata-0.3.2, doctestplus-0.4.0, openfiles-0.4.0 collected 42 items test_MakeInfo.py ………… [ 28%] test_MakeJSON.py … [ 35%] test_convert_refflat_to_bed.py .. [ 40%] test_generate_igv_samples.py … [ 47%] test_sample_info_to_jsons.py …. ..

Read more

While trying to improve code coverage of unit tests in my python flask app I am encountering some code coverage gaps. So there is a 404 error handler @app.errorhandler(404) def page_not_found(e): app.logger.exception(e) if isinstance(e, HTTPException): return e return "404 Page not Found", 404 With this unit test def test_404_check(app, client): res = client.get(‘/testof404’) assert res.status_code ..

Read more

I have a python project for which I have written a test case, the test case is executing successfully. However for some reason, while running the case with the coverage command I am getting an error. Command: coverage run –source=. -m pytest C:/workspace/DRP/python/myProject/test_handler.py coverage report Error: At line:1 char:151 + … culations_pythontestscross_account_accesstest_handler.py & coverag … ..

Read more