Skip to content

Commit 2bda955

Browse files
authored
Merge pull request #89 from a5chin/feature/test
Fix test
2 parents 06aa6f1 + 47b80b6 commit 2bda955

File tree

12 files changed

+625
-749
lines changed

12 files changed

+625
-749
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
**/.hypothesis/
6262
**/.pytest_cache/
6363
**/cover/
64+
pytest.xml
65+
pytest-coverage.txt
6466

6567
# Translations
6668
**/*.mo
Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
name: Install Python with uv
22
description: |
33
This GitHub Action installs Python using the uv tool.
4-
It pins the specified Python version, caches uv files, and installs dependencies.
5-
6-
inputs:
7-
python-version:
8-
description: Python version
9-
required: true
4+
It caches uv files, and installs dependencies.
105
116
runs:
127
using: composite
138

149
steps:
10+
- name: Extract Python Version
11+
run: echo "PYTHON_VERSION=$(cat .python-version)" >> $GITHUB_ENV
12+
shell: bash
13+
1514
- name: Install uv
1615
uses: astral-sh/setup-uv@v6
1716
with:
1817
enable-cache: true
19-
python-version: ${{ inputs.python-version }}
18+
python-version: ${{ env.PYTHON_VERSION }}
2019

2120
- name: Install Dependencies
2221
run: uv sync --frozen
2322
shell: bash
24-
25-
- name: Activate venv
26-
run: |
27-
uv venv
28-
source .venv/bin/activate
29-
shell: bash

.github/workflows/format.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,12 @@ jobs:
1010
ruff:
1111
runs-on: ubuntu-latest
1212

13-
strategy:
14-
matrix:
15-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16-
1713
steps:
1814
- name: Checkout
1915
uses: actions/checkout@v4
2016

21-
- name: Setup Python ${{ matrix.python-version }} with uv
17+
- name: Setup Python with uv
2218
uses: ./.github/actions/setup-python-with-uv
23-
with:
24-
python-version: ${{ matrix.python-version }}
2519

2620
- name: Format by Ruff
2721
run: uv run nox -s fmt

.github/workflows/gh-deploy.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ jobs:
2323
name: github-actions[bot]
2424
email: 41898282+github-actions[bot]@users.noreply.github.com
2525

26-
- name: Setup Python 3.13 with uv
26+
- name: Setup Python with uv
2727
uses: ./.github/actions/setup-python-with-uv
28-
with:
29-
python-version: 3.13
3028

3129
- name: Generate cache id
3230
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV

.github/workflows/lint.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,12 @@ jobs:
1010
pyright-and-ruff:
1111
runs-on: ubuntu-latest
1212

13-
strategy:
14-
matrix:
15-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
16-
1713
steps:
1814
- name: Checkout
1915
uses: actions/checkout@v4
2016

21-
- name: Setup Python ${{ matrix.python-version }} with uv
17+
- name: Setup Python with uv
2218
uses: ./.github/actions/setup-python-with-uv
23-
with:
24-
python-version: ${{ matrix.python-version }}
2519

2620
- name: Lint by Pyright and Ruff
2721
run: uv run nox -s lint

.github/workflows/test.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,17 @@ jobs:
1010
coverage:
1111
runs-on: ubuntu-latest
1212

13-
strategy:
14-
matrix:
15-
python-version: ["3.13"]
16-
1713
steps:
1814
- name: Checkout
1915
uses: actions/checkout@v4
2016

21-
- name: Setup Python ${{ matrix.python-version }} with uv
17+
- name: Setup Python with uv
2218
uses: ./.github/actions/setup-python-with-uv
23-
with:
24-
python-version: ${{ matrix.python-version }}
2519

2620
- name: Run pytest
2721
run: |
2822
set -o pipefail
29-
uv run pytest --junitxml=pytest.xml | tee pytest-coverage.txt
23+
uv run nox -s test -- --junitxml pytest.xml | tee pytest-coverage.txt
3024
3125
- name: Pytest coverage comment
3226
uses: MishaKav/pytest-coverage-comment@v1

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ coverage.xml
7878
.hypothesis/
7979
.pytest_cache/
8080
cover/
81+
pytest.xml
82+
pytest-coverage.txt
8183

8284
# Translations
8385
*.mo

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
66
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
77

8-
[![Versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12%20|%203.13%20-green.svg)](https://github.com/a5chin/python-uv)
8+
[![Versions](https://img.shields.io/badge/python-3.10%20|%203.11%20|%203.12%20|%203.13%20-green.svg)](https://github.com/a5chin/python-uv)
99
![code coverage](https://raw.githubusercontent.com/a5chin/python-uv/coverage-badge/coverage.svg?raw=true)
1010

1111
[![Docker](https://github.com/a5chin/python-uv/actions/workflows/docker.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/docker.yml)
12-
[![Pyright](https://github.com/a5chin/python-uv/actions/workflows/pyright.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/pyright.yml)
13-
[![Ruff](https://github.com/a5chin/python-uv/actions/workflows/ruff.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/ruff.yml)
12+
[![Format](https://github.com/a5chin/python-uv/actions/workflows/format.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/format.yml)
13+
[![Lint](https://github.com/a5chin/python-uv/actions/workflows/lint.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/lint.yml)
1414
[![Test](https://github.com/a5chin/python-uv/actions/workflows/test.yml/badge.svg)](https://github.com/a5chin/python-uv/actions/workflows/test.yml)
1515

1616
</div>

noxfile.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class CLIArgs(
1010
):
1111
"""CLIArgs is a class that extends BaseSettings to handle command line arguments."""
1212

13+
junitxml: str | None = None
14+
1315
@classmethod
1416
def parse(cls, posargs: list[str]) -> "CLIArgs":
1517
"""Parse command line arguments from the provided list.
@@ -78,6 +80,12 @@ def test(session: nox.Session) -> None:
7880
>>> uv run nox -s test
7981
8082
"""
81-
session.run("uv", "run", "pytest")
83+
args = CLIArgs.parse(session.posargs)
84+
85+
command = ["uv", "run", "pytest"]
86+
if args.junitxml:
87+
command.append(f"--junitxml={args.junitxml}")
88+
89+
session.run(*command)
8290

8391
session.log("✅ Testing completed successfully.")

0 commit comments

Comments
 (0)