question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I configure to color coverage on Azure Functions (Python) Project?

See original GitHub issue

I try to apply your extension to Azure Functions (Python) Project.

However, vscode editor lines are not colored, and ā€œNo Coverageā€ is displayed.

When I exuecute your project example, the editor lines are colored, and ā€œxx% Coverageā€ is displayed. So, my local machine seems to be fine.

My project repository is here.

And I upload 2 screenshots. (your project example and my Azure Functions project) your_project_example my_azure_functions_project

I switched to Python interpreter from project’s .venv to local machine’s global exe, however the problem didn’t solve.

How do I configure to color coverage on Azure Functions (Python) Project?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ryanlukercommented, May 21, 2022

@ecormaksin I ran your example project locally and was able to get the coverage to be picked up by doing the following.

[1653143161420][coverageservice]: LOADING
[1653143161440][coverageservice]: Loading 1 file(s)
[1653143161440][coverageservice]: c:\Users\ryanl\dev\azure_functions_coverage_test\cov.xml
[1653143161440][coverageservice]: Loaded 1 data file(s)
[1653143161441][coverageservice]: Caching 6 coverage(s)
[1653143161441][coverageservice]: READY
[1653143161441][coverageservice]: RENDERING
[1653143161441][renderer][section test name]: module_a.py
[1653143161441][renderer][section file path]: C:\Users\ryanl\dev\azure_functions_coverage_test\shared_code\module_a.py
[1653143161441][coverageservice]: READY
[1653143161441][coverageservice]: Listening to file system at {c:\Users\ryanl\dev\azure_functions_coverage_test}/**/{lcov.info,cov.xml,coverage.xml,jacoco.xml,coverage.cobertura.xml}
(venv) PS C:\Users\ryanl\dev\azure_functions_coverage_test> py.test --cov-report xml:cov.xml --cov
========================================================== test session starts ==========================================================
platform win32 -- Python 3.10.4, pytest-7.1.2, pluggy-1.0.0
rootdir: C:\Users\ryanl\dev\azure_functions_coverage_test
plugins: cov-3.0.0
collected 2 items

tests\test_ClassB.py .                                                                                                             [ 50%]
tests\test_module_a.py .                                                                                                           [100%]

---------- coverage: platform win32, python 3.10.4-final-0 -----------
Coverage XML written to file cov.xml


=========================================================== 2 passed in 0.12s ===========================================================
(venv) PS C:\Users\ryanl\dev\azure_functions_coverage_test>

The key might have been to run the coverage report across the whole project. Let me know if that helps! py.test --cov-report xml:cov.xml --cov

1reaction
ryanlukercommented, May 23, 2022

@ecormaksin excellent! Happy coding 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure DevOps Pipeline: Showing code coverage report for ...
To see code coverage I think you need to add task PublishCodeCoverageResults@1.
Read more >
Python developer reference for Azure Functions
This guide is an introduction to developing Azure Functions by using Python. The article assumes that you've already read the AzureĀ ...
Read more >
Customizing Code Coverage Analysis - Visual Studio (Windows)
To select the run settings file, on the Test menu, choose Select Settings File. To specify a run settings file for running tests...
Read more >
Code coverage testing - Visual Studio (Windows)
Show Code Coverage Coloring in the Code Coverage Results window. By default, code that is covered by tests is highlighted in light blue....
Read more >
Create your first durable function in Azure using Python
In Visual Studio Code, press F1 (or Ctrl/Cmd+Shift+P ) to open the command palette. In the command palette, search for and select Azure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found