Skip to content

Commit

Permalink
setting pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
kaihsin committed Nov 19, 2024
1 parent 1f8cdc7 commit 4257f2f
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/python_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Pytest
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true


jobs:
uv-test:
name: python
runs-on: ubuntu-latest

strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
# Install a specific version of uv.
version: "0.5.1"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Setup Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install the project
run: uv sync --all-extras --dev

- name: Run tests
run: uv run pytest
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
build/*
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# venv
.venv
2 changes: 1 addition & 1 deletion src/cytnx_core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from test_build._core import hello_from_bin
from cytnx_core._core import hello_from_bin


def hello() -> str:
Expand Down
Binary file added src/cytnx_core/__pycache__/__init__.cpython-312.pyc
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions test/test_simple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from cytnx_core import hello


def test_str():
assert isinstance(hello(), str)

0 comments on commit 4257f2f

Please sign in to comment.