Skip to content

Commit 0812858

Browse files
authored
feat(tests): Do not include type checking code in coverage report (#3327)
This should not count lines (or rather if blocks) that start with if TYPE_CHECKING in the code coverage report, because this code is only evaluated when checking types with mypy.
1 parent 357d6f5 commit 0812858

13 files changed

+25
-22
lines changed

Diff for: .github/workflows/test-integrations-ai.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
allow-prereleases: true
4040
- name: Setup Test Env
4141
run: |
42-
pip install coverage tox
42+
pip install "coverage[toml]" tox
4343
- name: Erase coverage
4444
run: |
4545
coverage erase
@@ -101,7 +101,7 @@ jobs:
101101
allow-prereleases: true
102102
- name: Setup Test Env
103103
run: |
104-
pip install coverage tox
104+
pip install "coverage[toml]" tox
105105
- name: Erase coverage
106106
run: |
107107
coverage erase

Diff for: .github/workflows/test-integrations-aws-lambda.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
allow-prereleases: true
7575
- name: Setup Test Env
7676
run: |
77-
pip install coverage tox
77+
pip install "coverage[toml]" tox
7878
- name: Erase coverage
7979
run: |
8080
coverage erase

Diff for: .github/workflows/test-integrations-cloud-computing.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
allow-prereleases: true
4040
- name: Setup Test Env
4141
run: |
42-
pip install coverage tox
42+
pip install "coverage[toml]" tox
4343
- name: Erase coverage
4444
run: |
4545
coverage erase
@@ -97,7 +97,7 @@ jobs:
9797
allow-prereleases: true
9898
- name: Setup Test Env
9999
run: |
100-
pip install coverage tox
100+
pip install "coverage[toml]" tox
101101
- name: Erase coverage
102102
run: |
103103
coverage erase

Diff for: .github/workflows/test-integrations-common.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
allow-prereleases: true
4040
- name: Setup Test Env
4141
run: |
42-
pip install coverage tox
42+
pip install "coverage[toml]" tox
4343
- name: Erase coverage
4444
run: |
4545
coverage erase

Diff for: .github/workflows/test-integrations-data-processing.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
uses: supercharge/[email protected]
4242
- name: Setup Test Env
4343
run: |
44-
pip install coverage tox
44+
pip install "coverage[toml]" tox
4545
- name: Erase coverage
4646
run: |
4747
coverage erase
@@ -109,7 +109,7 @@ jobs:
109109
uses: supercharge/[email protected]
110110
- name: Setup Test Env
111111
run: |
112-
pip install coverage tox
112+
pip install "coverage[toml]" tox
113113
- name: Erase coverage
114114
run: |
115115
coverage erase

Diff for: .github/workflows/test-integrations-databases.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
- uses: getsentry/action-clickhouse-in-ci@v1
5959
- name: Setup Test Env
6060
run: |
61-
pip install coverage tox
61+
pip install "coverage[toml]" tox
6262
- name: Erase coverage
6363
run: |
6464
coverage erase
@@ -143,7 +143,7 @@ jobs:
143143
- uses: getsentry/action-clickhouse-in-ci@v1
144144
- name: Setup Test Env
145145
run: |
146-
pip install coverage tox
146+
pip install "coverage[toml]" tox
147147
- name: Erase coverage
148148
run: |
149149
coverage erase

Diff for: .github/workflows/test-integrations-graphql.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
allow-prereleases: true
4040
- name: Setup Test Env
4141
run: |
42-
pip install coverage tox
42+
pip install "coverage[toml]" tox
4343
- name: Erase coverage
4444
run: |
4545
coverage erase
@@ -97,7 +97,7 @@ jobs:
9797
allow-prereleases: true
9898
- name: Setup Test Env
9999
run: |
100-
pip install coverage tox
100+
pip install "coverage[toml]" tox
101101
- name: Erase coverage
102102
run: |
103103
coverage erase

Diff for: .github/workflows/test-integrations-miscellaneous.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
allow-prereleases: true
4040
- name: Setup Test Env
4141
run: |
42-
pip install coverage tox
42+
pip install "coverage[toml]" tox
4343
- name: Erase coverage
4444
run: |
4545
coverage erase
@@ -101,7 +101,7 @@ jobs:
101101
allow-prereleases: true
102102
- name: Setup Test Env
103103
run: |
104-
pip install coverage tox
104+
pip install "coverage[toml]" tox
105105
- name: Erase coverage
106106
run: |
107107
coverage erase

Diff for: .github/workflows/test-integrations-networking.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
allow-prereleases: true
4040
- name: Setup Test Env
4141
run: |
42-
pip install coverage tox
42+
pip install "coverage[toml]" tox
4343
- name: Erase coverage
4444
run: |
4545
coverage erase
@@ -97,7 +97,7 @@ jobs:
9797
allow-prereleases: true
9898
- name: Setup Test Env
9999
run: |
100-
pip install coverage tox
100+
pip install "coverage[toml]" tox
101101
- name: Erase coverage
102102
run: |
103103
coverage erase

Diff for: .github/workflows/test-integrations-web-frameworks-1.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
allow-prereleases: true
5858
- name: Setup Test Env
5959
run: |
60-
pip install coverage tox
60+
pip install "coverage[toml]" tox
6161
- name: Erase coverage
6262
run: |
6363
coverage erase
@@ -133,7 +133,7 @@ jobs:
133133
allow-prereleases: true
134134
- name: Setup Test Env
135135
run: |
136-
pip install coverage tox
136+
pip install "coverage[toml]" tox
137137
- name: Erase coverage
138138
run: |
139139
coverage erase

Diff for: .github/workflows/test-integrations-web-frameworks-2.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
allow-prereleases: true
4040
- name: Setup Test Env
4141
run: |
42-
pip install coverage tox
42+
pip install "coverage[toml]" tox
4343
- name: Erase coverage
4444
run: |
4545
coverage erase
@@ -117,7 +117,7 @@ jobs:
117117
allow-prereleases: true
118118
- name: Setup Test Env
119119
run: |
120-
pip install coverage tox
120+
pip install "coverage[toml]" tox
121121
- name: Erase coverage
122122
run: |
123123
coverage erase

Diff for: pyproject.toml

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ extend-exclude = '''
88
| .*_pb2_grpc.py # exclude autogenerated Protocol Buffer files anywhere in the project
99
)
1010
'''
11+
[tool.coverage.report]
12+
exclude_also = [
13+
"if TYPE_CHECKING:",
14+
]

Diff for: scripts/split-tox-gh-actions/templates/test_group.jinja

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@
6161

6262
- name: Setup Test Env
6363
run: |
64-
pip install coverage tox
65-
64+
pip install "coverage[toml]" tox
6665
- name: Erase coverage
6766
run: |
6867
coverage erase

0 commit comments

Comments
 (0)