Skip to content

Commit f426d70

Browse files
committed
Add test coverage support
1 parent 7c89e92 commit f426d70

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎.github/workflows/test.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ jobs:
6161
run: make test-unit
6262
- name: Run integration/system tests
6363
run: make test-integration
64+
- name: Coverage summary
65+
run: |
66+
echo "## Coverage" >> "$GITHUB_STEP_SUMMARY"
67+
echo '```' >> "$GITHUB_STEP_SUMMARY"
68+
make coverage-report | tee -a "$GITHUB_STEP_SUMMARY"
69+
echo '```' >> "$GITHUB_STEP_SUMMARY"

‎Makefile‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ docs-zip: docs
7272
# -ra prints a report on all failed tests after a run
7373
# -vv shows why a test failed while the rest of the suite is running
7474
PYTHON_CMD := uv run python
75-
PYTEST_CMD := $(PYTHON_CMD) -m pytest --no-header --ff -ra -vv
75+
COV_ARGS := --cov=splunklib --cov-report=term-missing --cov-append
76+
PYTEST_CMD := $(PYTHON_CMD) -m pytest --no-header --ff -ra -vv $(COV_ARGS)
7677

7778
.PHONY: test
7879
test:
@@ -90,6 +91,10 @@ test-integration:
9091
test-ai:
9192
$(PYTEST_CMD) ./tests/integration/ai ./tests/unit/ai
9293

94+
.PHONY: coverage-report
95+
coverage-report:
96+
$(UV_RUN_CMD) coverage report
97+
9398
## DOCKER
9499

95100
CONTAINER_NAME := splunk

0 commit comments

Comments
 (0)