Skip to content

Commit fb91f7b

Browse files
authored
Add test coverage to CI (#17)
Also fixes a reused test name that was shadowing a test.
1 parent 51fdf28 commit fb91f7b

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ name: 'Build and Test'
33
on: [push, pull_request, workflow_dispatch]
44

55
env:
6+
COVERAGE_CORE: sysmon
7+
FORCE_COLOR: 1
68
PIP_DISABLE_PIP_VERSION_CHECK: true
7-
PIP_NO_COLOR: true
89
PIP_NO_INPUT: true
910
PIP_PROGRESS_BAR: off
1011
PIP_REQUIRE_VIRTUALENV: false
@@ -38,13 +39,22 @@ jobs:
3839
run: python -m pip install pymsbuild
3940

4041
- name: 'Install test runner'
41-
run: python -m pip install pytest
42+
run: python -m pip install pytest pytest-cov
4243

4344
- name: 'Build test module'
4445
run: python -m pymsbuild -c _msbuild_test.py
4546

4647
- name: 'Run pre-test'
47-
run: python -m pytest -vv
48+
shell: bash
49+
run: |
50+
python -m pytest -vv \
51+
--cov src \
52+
--cov tests \
53+
--cov-report term \
54+
--cov-report xml
55+
56+
- name: 'Upload coverage'
57+
uses: codecov/codecov-action@v5
4858

4959
- name: 'Build package'
5060
run: python make.py

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Python Install Manager
22

3+
[![Codecov](https://codecov.io/gh/python/pymanager/graph/badge.svg)](https://codecov.io/gh/python/pymanager)
4+
35
This is the source code for the Python Install Manager app.
46

57
For information about how to use the Python install manager,

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
[build-system]
22
requires = ['pymsbuild>=1.1.1,<2.0']
3-
build-backend = "pymsbuild"
3+
build-backend = "pymsbuild"
4+
5+
[tool.coverage.run]
6+
branch = true
7+
disable_warnings = [
8+
"no-sysmon",
9+
]
10+
omit = [
11+
"src/manage/__main__.py",
12+
]
13+
14+
[tool.coverage.html]
15+
show_contexts = true

tests/test_installs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def test_get_install_to_run_with_platform(patched_installs):
120120
assert i["executable"].match("python.exe")
121121

122122

123-
def test_get_install_to_run_with_platform(patched_installs):
123+
def test_get_install_to_run_with_platform_windowed(patched_installs):
124124
i = installs.get_install_to_run("<none>", None, "1.0-32", windowed=True)
125125
assert i["id"] == "PythonCore-1.0-32"
126126
assert i["executable"].match("pythonw.exe")

0 commit comments

Comments
 (0)