Skip to content

Commit fdbc454

Browse files
committed
ci: add CI test pipeline and refactor tests to pytest format
- Add .github/workflows/ci.yml: runs pytest on Python 3.10-3.13 across ubuntu/macos/windows on push and PR to main - Add [project.optional-dependencies] test group and [tool.pytest.ini_options] to pyproject.toml - Replace all 11 _test_*.py plain scripts with proper test_*.py pytest files: each test file uses test functions with assertions instead of print statements, covering SVM, SVR, CQR, ElasticNet, FairSVM, MF, monotonic, multiclass, path solution, sklearn mixin, and warm-start - 40 tests pass locally
1 parent 5a9de01 commit fdbc454

24 files changed

Lines changed: 1619 additions & 1946 deletions

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths-ignore:
7+
- "**.md"
8+
- "doc/**"
9+
- "LICENSE"
10+
- ".gitignore"
11+
pull_request:
12+
branches: [main]
13+
14+
jobs:
15+
test:
16+
name: "Python ${{ matrix.python-version }} / ${{ matrix.os }}"
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, macos-latest, windows-latest]
22+
python-version: ["3.10", "3.11", "3.12", "3.13"]
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install package and test dependencies
33+
run: pip install ".[test]"
34+
35+
- name: Run tests
36+
run: pytest -v --tb=short

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ py-modules = ["build"]
3030
# Only build on CPython
3131
build = "cp*"
3232

33+
[project.optional-dependencies]
34+
test = ["pytest >= 7.0"]
35+
36+
[tool.pytest.ini_options]
37+
testpaths = ["tests"]
38+
python_files = ["test_*.py"]
39+
python_classes = ["Test*"]
40+
python_functions = ["test_*"]
41+
3342
[build-system]
3443
requires = ["requests ~= 2.31.0", "pybind11 ~= 3.0.0", "setuptools >= 80.0.0", "wheel >= 0.42.0"]
3544
build-backend = "setuptools.build_meta"

tests/_test_cqr.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)