Skip to content

Commit e045dcf

Browse files
committedJul 18, 2024
feat: add test coverage
1 parent d3b532c commit e045dcf

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed
 

‎.github/workflows/test.yml

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
name: Python
22
on: [push, pull_request]
33
jobs:
4-
build:
4+
Pytest:
55
runs-on: ubuntu-latest
6-
strategy:
7-
matrix:
8-
python-version: ["3.10", "3.11", "3.12"]
96
steps:
107
- uses: actions/checkout@v4
118
- name: Set up Python ${{ matrix.python-version }}
129
uses: actions/setup-python@v5
1310
with:
14-
python-version: ${{ matrix.python-version }}
11+
python-version: '3.10'
12+
cache: 'pip'
1513
- name: Install dependencies
1614
run: |
17-
python -m pip install --upgrade pip pytest
15+
python -m pip install --upgrade pip pytest pytest-cov
1816
pip install .
1917
- name: Test with pytest
2018
run: |
21-
pytest tests
19+
pytest --junitxml=pytest.xml --cov-report "xml:coverage.xml" --cov=git_hg_sync tests/
20+
ls git_hg_sync
21+
cat coverage.xml
22+
- name: Pytest coverage comment
23+
uses: MishaKav/pytest-coverage-comment@main
24+
with:
25+
pytest-xml-coverage-path: coverage.xml
26+
title: Coverage
27+
badge-title: Coverage
28+
junitxml-path: pytest.xml
29+
junitxml-title: JUnit Xml Summary

‎.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
clones
22
.tox
33
**/__pycache__/
4-
config.ini
4+
config.ini
5+
.coverage

‎tox.ini

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ setenv = PYTHONPATH = ""
88
[testenv:pytest]
99
changedir = tests
1010
passenv = PULSE_PASSWORD
11-
deps = pytest
12-
commands = pytest
11+
deps =
12+
pytest
13+
pytest-cov
14+
commands = pytest --cov=git_hg_sync --cov-report=html
1315

1416
[testenv:lint]
1517
description = lint source code

0 commit comments

Comments
 (0)
Failed to load comments.