Skip to content

Commit 48f7320

Browse files
CarltonXiangharvey_xiang
andauthored
feat: add test cov ci (#1272)
* feat: add test cov ci * ci: update pr tpl * feat: update poetry * ci: update pr tpl --------- Co-authored-by: harvey_xiang <harvey_xiang22@163.com>
1 parent 2a7a5ce commit 48f7320

6 files changed

Lines changed: 231 additions & 9 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

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

33
Please include a summary of the change, the problem it solves, the implementation approach, and relevant context. List any dependencies required for this change.
44

5-
Related Issue (Required): Fixes @issue_number
5+
Related Issue (Required): Fixes #issue_number
66

77
## Type of change
88

.github/workflows/python-tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ jobs:
102102
if: ${{ !startsWith(matrix.os, 'macos-13') }}
103103
run: |
104104
poetry install --no-interaction --extras all
105-
- name: PyTest unit tests
105+
- name: PyTest unit tests with coverage
106106
if: ${{ !startsWith(matrix.os, 'macos-13') }}
107+
shell: bash
107108
run: |
108-
poetry run pytest tests -vv --durations=10
109+
poetry run pytest tests -vv --durations=10 \
110+
--cov=src/memos \
111+
--cov-report=term-missing \
112+
--cov-fail-under=28

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ pip-delete-this-directory.txt
6363

6464
# Unit test / coverage reports
6565
htmlcov/
66+
report/
67+
cov-report/
6668
.tox/
6769
.nox/
6870
.coverage

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: test
1+
.PHONY: test test-report test-cov
22

33
install:
44
poetry install --extras all --with dev --with test
@@ -9,10 +9,25 @@ clean:
99
rm -rf .pytest_cache
1010
rm -rf .ruff_cache
1111
rm -rf tmp
12+
rm -rf report cov-report
13+
rm -f .coverage .coverage.*
1214

1315
test:
1416
poetry run pytest tests
1517

18+
test-report:
19+
poetry run pytest tests -vv --durations=10 \
20+
--html=report/index.html \
21+
--cov=src/memos \
22+
--cov-report=term-missing \
23+
--cov-report=html:cov-report/src
24+
25+
test-cov:
26+
poetry run pytest tests \
27+
--cov=src/memos \
28+
--cov-report=term-missing \
29+
--cov-report=html:cov-report/src
30+
1631
format:
1732
poetry run ruff check --fix
1833
poetry run ruff format

0 commit comments

Comments
 (0)