Skip to content

Commit 8bdc4ad

Browse files
authored
Updated project build and CI using uv (#3)
1 parent ef38f4b commit 8bdc4ad

File tree

8 files changed

+85
-17
lines changed

8 files changed

+85
-17
lines changed

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish markus-autotesting-core package to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
run:
9+
name: Publish package
10+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: pypi
14+
permissions:
15+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
16+
contents: read
17+
steps:
18+
- uses: actions/checkout@v6
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v7
21+
with:
22+
enable-cache: true
23+
- name: Install Python
24+
run: uv python install
25+
- name: Build the package
26+
run: uv build
27+
- name: Publish
28+
run: uv publish

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.13"]
16+
17+
steps:
18+
- name: Check out repository
19+
uses: actions/checkout@v6
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v7
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
enable-cache: true
26+
27+
- name: Sync dependencies
28+
run: uv sync --locked --all-extras --dev
29+
30+
- name: Run tests
31+
run: uv run pytest -vv

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changelog
2+
3+
## [unreleased]

pyproject.toml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "markus-autotesting-core"
33
version = "0.1.0"
44
description = "Core functionality for Markus Autotesting"
5-
authors = [
5+
maintainers = [
66
{name = "David Liu", email = "[email protected]"}
77
]
88
license = "MIT"
@@ -18,19 +18,8 @@ Homepage = "https://github.com/MarkUsProject/markus-autotesting-core"
1818
Repository = "https://github.com/MarkUsProject/markus-autotesting-core.git"
1919

2020
[build-system]
21-
requires = ["setuptools", "wheel"]
22-
build-backend = "setuptools.build_meta"
23-
24-
[tool.setuptools]
25-
include-package-data = true
26-
zip-safe = false
27-
28-
[tool.setuptools.dynamic]
29-
version = {attr = "python_ta.__version__"}
30-
#readme = {file = "README.md", content-type = "text/markdown"}
31-
32-
[tool.setuptools.packages.find]
33-
include = ["markus_autotesting_core*"]
21+
requires = ["uv_build>=0.9.21,<0.10.0"]
22+
build-backend = "uv_build"
3423

3524
[dependency-groups]
3625
dev = [
File renamed without changes.
File renamed without changes.

tests/test_types/test_core.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import json
2+
3+
import msgspec
4+
import pytest
15
from markus_autotesting_core.types import BaseTestData
26

37

@@ -14,9 +18,6 @@ def test_base_test_data_fields():
1418

1519
def test_base_test_data_decoding():
1620
"""Test that an instance of BaseTestData can be dencoded from JSON."""
17-
import msgspec
18-
import json
19-
2021
json_data = json.dumps(
2122
{
2223
"category": ["unit", "integration"],
@@ -34,3 +35,19 @@ def test_base_test_data_decoding():
3435
assert decoded.timeout == 60
3536
assert decoded.feedback_file_names == ["feedback.txt"]
3637
assert decoded.extra_info == {"note": "This is a test."}
38+
39+
40+
def test_base_test_data_decoding_error():
41+
"""Test that invalid JSON is not decoded into a BaseTestData instance."""
42+
json_data = json.dumps(
43+
{
44+
"category": ["unit", "integration"],
45+
"script_files": [],
46+
"timeout": 60,
47+
"feedback_file_names": ["feedback.txt"],
48+
"extra_info": {"note": "This is a test."},
49+
}
50+
)
51+
52+
with pytest.raises(msgspec.ValidationError):
53+
msgspec.json.decode(json_data, type=BaseTestData)

0 commit comments

Comments
 (0)