-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add some unit tests #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
74a9a0e
af85a62
51a0dc2
3a70bbb
5b2d508
b90c681
d0f6b86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| coverage: | ||
| status: | ||
| # 1. Project Coverage: Enforces rules on the entire codebase | ||
| project: | ||
| default: | ||
| target: auto # 'auto' means the PR cannot decrease the overall coverage | ||
| threshold: 1% # Allows a 1% drop margin for acceptable fluctuations | ||
|
|
||
| # 2. Patch Coverage: Enforces rules ONLY on the lines of code modified in the PR | ||
| patch: | ||
| default: | ||
| target: 80% # The specific requirement you asked for: 80% on new code | ||
|
|
||
| # 3. Ignore paths: Exclude test files and configs from coverage calculations | ||
| ignore: | ||
| - "tests/**/*" | ||
| - ".github/**/*" | ||
| - "**/__init__.py" | ||
|
|
||
| # Optional: Configure the Codecov PR comment bot | ||
| comment: | ||
| layout: "reach, diff, flags, files" | ||
| behavior: default | ||
| require_changes: false # Always post a comment, even if coverage didn't change |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: pr-gate | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| concurrency: | ||
| group: pr-gate-${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v6 | ||
| with: | ||
| version: "0.10.4" | ||
|
|
||
| - name: Set up Python | ||
| run: uv python install 3.12 | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync | ||
|
|
||
| - name: Run tests with coverage | ||
| run: uv run pytest --cov --cov-report=xml | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| files: coverage.xml | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| fail_ci_if_error: true | ||
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,7 @@ dev = [ | |
| "pytest>=8.3.5,<9.0.0", | ||
| "pytest-asyncio>=0.26.0,<0.27.0", | ||
| "celery-types>=0.24.0", | ||
| "pytest-cov>=7.1.0", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: The latest version of the pytest-cov package on PyPI is 7.0.0. Citations:
Change pytest-cov version constraint from 7.1.0 to 7.0.0 or lower. The version 7.1.0 does not exist on PyPI; the latest available version is 7.0.0. Update the constraint to 🤖 Prompt for AI Agents |
||
| ] | ||
|
|
||
| [build-system] | ||
|
|
@@ -74,3 +75,4 @@ fastfetchbot-file-export = { workspace = true } | |
|
|
||
| [tool.pytest.ini_options] | ||
| asyncio_default_fixture_loop_scope = "module" | ||
| testpaths = ["tests"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uv syncwill not install dev dependencies including pytest.The
devdependency group (containingpytest,pytest-asyncio,pytest-cov) is not included by default withuv sync. Without the--group devflag, pytest won't be available and the workflow will fail at the "Run tests" step.🐛 Proposed fix
🤖 Prompt for AI Agents