Skip to content

Commit fa9e9f5

Browse files
authored
Adding new task in CI to report code-coverage in branches and PRs. (#668)
* Adding new task in CI to report code-coverage in branches and PRs. * Refactoring thirdparty libs into a separate module.
1 parent da2b264 commit fa9e9f5

16 files changed

+91
-13
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -e -x
4+
5+
coverage combine
6+
coverage xml
7+
coverage erase

.ci/linux_devops_e2e_tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export AzureWebJobsStorage=$LINUXSTORAGECONNECTIONSTRING
55
export AzureWebJobsCosmosDBConnectionString=$LINUXCOSMOSDBCONNECTIONSTRING
66
export AzureWebJobsEventHubConnectionString=$LINUXEVENTHUBCONNECTIONSTRING
77
export AzureWebJobsServiceBusConnectionString=$LINUXSERVICEBUSCONNECTIONSTRING
8-
pytest tests/endtoend
8+
9+
coverage run -p --branch -m pytest tests/endtoend

.ci/linux_devops_unit_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22

33
set -e -x
4-
pytest tests/unittests
4+
coverage run -p --branch -m pytest tests/unittests

.coveragerc

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[run]
2+
parallel=True
3+
4+
[report]
5+
# Regexes for lines to exclude from consideration
6+
exclude_lines =
7+
# Have to re-enable the standard pragma
8+
pragma: no cover
9+
def __repr__
10+
11+
# Don't complain about missing debug-only code:
12+
if self\.debug
13+
14+
# Don't complain if tests don't hit defensive assertion code:
15+
raise AssertionError
16+
raise NotImplementedError
17+
18+
# Don't complain if non-runnable code isn't run:
19+
if 0:
20+
if False:
21+
if __name__ == .__main__.:
22+
23+
# Not counting some extra lines which don't need to be counted.
24+
print
25+
def setUp
26+
def suite
27+
28+
ignore_errors = True
29+
30+
omit =
31+
*/build/*
32+
*/doc/*
33+
*/examples/*
34+
*/postprocessing/*
35+
*/test/*
36+
*/setup.py
37+
setup.py
38+
*/site-packages/*
39+
*/venv/*
40+
*/docs/*
41+
*/pack/*
42+
*/python/*
43+
*/build/*
44+
*/.venv/*
45+
*/.env*/*
46+
*/.vscode/*
47+
*/tests/*
48+
49+
# Removing the imported libraries that might show up in this.
50+
*/azure/functions/*
51+
*/azure/*
52+
*/azure_functions_worker/_thirdparty/*

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ ignore = W503,E402,E731
33
exclude =
44
.git, __pycache__, build, dist, .eggs, .github, .local, docs/,
55
Samples, azure_functions_worker/protos/,
6-
azure_functions_worker/typing_inspect.py,
6+
azure_functions_worker/_thirdparty/typing_inspect.py,
77
tests/unittests/test_typing_inspect.py,
88
.venv*, .env*, .vscode, venv

azure-pipelines.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ jobs:
4848
LINUXEVENTHUBCONNECTIONSTRING: $(LinuxEventHubConnectionString)
4949
LINUXSERVICEBUSCONNECTIONSTRING: $(LinuxServiceBusConnectionString)
5050
displayName: 'E2E Tests'
51+
- bash: |
52+
chmod +x .ci/linux_devops_code_coverage_generate.sh
53+
.ci/linux_devops_code_coverage_generate.sh
54+
displayName: 'Generate Code Coverage XML file'
55+
- task: PublishCodeCoverageResults@1
56+
inputs:
57+
codeCoverageTool: cobertura
58+
summaryFileLocation: coverage.xml
5159

5260
- job: Build_WINDOWS_X64
5361
dependsOn: 'Tests'

azure_functions_worker/_thirdparty/__init__.py

Whitespace-only changes.

azure_functions_worker/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from . import bindings
66
from . import protos
7-
from . import typing_inspect
7+
from ._thirdparty import typing_inspect
88

99

1010
class ParamTypeInfo(typing.NamedTuple):

0 commit comments

Comments
 (0)