diff --git a/.github/workflows/python_test.yml b/.github/workflows/python_test.yml new file mode 100644 index 0000000..5e5f722 --- /dev/null +++ b/.github/workflows/python_test.yml @@ -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 diff --git a/.gitignore b/.gitignore index a007fea..90ab317 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,9 @@ build/* +__pycache__/ +*.py[oc] +build/ +dist/ +wheels/ +*.egg-info +# venv +.venv diff --git a/src/cytnx_core/__init__.py b/src/cytnx_core/__init__.py index b146483..e581d39 100644 --- a/src/cytnx_core/__init__.py +++ b/src/cytnx_core/__init__.py @@ -1,4 +1,4 @@ -from test_build._core import hello_from_bin +from cytnx_core._core import hello_from_bin def hello() -> str: diff --git a/src/cytnx_core/__pycache__/__init__.cpython-312.pyc b/src/cytnx_core/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..4816ad3 Binary files /dev/null and b/src/cytnx_core/__pycache__/__init__.cpython-312.pyc differ diff --git a/test/__pycache__/test_simple.cpython-312-pytest-8.3.3.pyc b/test/__pycache__/test_simple.cpython-312-pytest-8.3.3.pyc new file mode 100644 index 0000000..0e269c9 Binary files /dev/null and b/test/__pycache__/test_simple.cpython-312-pytest-8.3.3.pyc differ diff --git a/test/test_simple.py b/test/test_simple.py new file mode 100644 index 0000000..25e4163 --- /dev/null +++ b/test/test_simple.py @@ -0,0 +1,5 @@ +from cytnx_core import hello + + +def test_str(): + assert isinstance(hello(), str)