[PR #18106] [Unit Test] Generate coverage number for UT #28838

Closed
opened 2026-02-21 20:44:13 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/18106

State: closed
Merged: Yes


Summary

This pull request includes changes to enhance the test coverage reporting and improve the testing setup for the api project. The most important changes include modifications to the GitHub Actions workflow, updates to the testing dependencies, and enhancements to the unit test script.

Enhancements to test coverage reporting:

  • .github/workflows/api-tests.yml: Modified the unit test step to extract coverage percentage, create a summary, and include a detailed coverage report in the GitHub Actions summary.

Updates to testing dependencies:

  • api/pyproject.toml: Added pytest-cov to the development dependencies to support coverage reporting.

Enhancements to unit test script:

Screenshots

Please refer to https://github.com/langgenius/dify/actions/runs/14470441988?pr=18106 to check the result.

Before After
... image

Checklist

Important

Please review the checklist below before submitting your pull request.

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/18106 **State:** closed **Merged:** Yes --- # Summary This pull request includes changes to enhance the test coverage reporting and improve the testing setup for the `api` project. The most important changes include modifications to the GitHub Actions workflow, updates to the testing dependencies, and enhancements to the unit test script. Enhancements to test coverage reporting: * [`.github/workflows/api-tests.yml`](diffhunk://#diff-8c3f82f0b002430c7b079361d8dbc0662a32467f16bc9d20b5796745488abdf8L48-R58): Modified the unit test step to extract coverage percentage, create a summary, and include a detailed coverage report in the GitHub Actions summary. Updates to testing dependencies: * [`api/pyproject.toml`](diffhunk://#diff-40f8f985c548e2b57b803d17f42833f8a4d94603ca5b5e0bf48de51872809400R105): Added `pytest-cov` to the development dependencies to support coverage reporting. Enhancements to unit test script: * [`dev/pytest/pytest_unit_tests.sh`](diffhunk://#diff-ce5b12fcbe42e28f4d438f8def34e1eb3f15b941913f5eef127516c0a569737bL5-R5): Updated the script to include coverage reporting with `--cov` and `--cov-report=json` options. # Screenshots Please refer to https://github.com/langgenius/dify/actions/runs/14470441988?pr=18106 to check the result. | Before | After | |--------|-------| | ... | ![image](https://github.com/user-attachments/assets/dd52ccdf-d6c0-4f87-a8db-f569fdfe78ca) | # Checklist > [!IMPORTANT] > Please review the checklist below before submitting your pull request. - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:44:13 -05:00
yindo closed this issue 2026-02-21 20:44:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#28838