@@ -64,13 +64,28 @@ jobs:
6464 python-version : ${{ matrix.python-version }}
6565 allow-prereleases : true
6666
67+ - name : Install coverage
68+ run : |
69+ # Be wary that this does not install typing_extensions in the future
70+ pip install coverage
71+
6772 - name : Test typing_extensions
6873 run : |
6974 # Be wary of running `pip install` here, since it becomes easy for us to
7075 # accidentally pick up typing_extensions as installed by a dependency
7176 cd src
7277 python --version # just to make sure we're running the right one
73- python -m unittest test_typing_extensions.py
78+ export COVERAGE_FILE=.coverage_${{ matrix.python-version }}
79+ # Run with coverage omit files that are executed in tempfiles
80+ coverage run --omit ann_module*,inspect* -m unittest test_typing_extensions.py
81+
82+ - name : Archive code coverage results
83+ uses : actions/upload-artifact@v4
84+ with :
85+ name : .coverage_${{ matrix.python-version }}
86+ path : ./src/.coverage*
87+ include-hidden-files : true
88+ compression-level : 0 # no compression
7489
7590 - name : Test CPython typing test suite
7691 # Test suite fails on PyPy even without typing_extensions
8095 # Run the typing test suite from CPython with typing_extensions installed,
8196 # because we monkeypatch typing under some circumstances.
8297 python -c 'import typing_extensions; import test.__main__' test_typing -v
83-
98+
8499 linting :
85100 name : Lint
86101
@@ -130,3 +145,36 @@ jobs:
130145 title: `Daily tests failed on ${new Date().toDateString()}`,
131146 body: "Runs listed here: https://github.com/python/typing_extensions/actions/workflows/ci.yml",
132147 })
148+
149+ report-coverage :
150+ name : Report coverage
151+
152+ runs-on : ubuntu-latest
153+
154+ needs : [tests]
155+
156+ if : ${{ always() }}
157+
158+ steps :
159+ - uses : actions/checkout@v4
160+ - name : Set up Python
161+ uses : actions/setup-python@v5
162+ with :
163+ python-version : " 3"
164+ - name : Download coverage artifacts
165+ uses : actions/download-artifact@v4
166+ with :
167+ pattern : .coverage_*
168+ path : .
169+ # merge only when files are named differently
170+ merge-multiple : true
171+ - name : Install dependencies
172+ run : pip install coverage
173+ - name : Combine coverage results
174+ run : |
175+ # List the files to see what we have
176+ echo "Combining coverage files:"
177+ coverage combine --data-file=.coverage .coverage*
178+ # add -i to ignore parsed code of temp files.
179+ coverage report -i
180+ coverage xml -i
0 commit comments