diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..2f802c6 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,22 @@ +name: Test my project + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["pypy3.10", "3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + # You can test your matrix by printing the current Python version + - name: Display Python version + run: python -c "import sys; print(sys.version)" + diff --git a/pyproject.toml b/pyproject.toml index 66ce77b..0f781f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,3 +12,7 @@ packages = ["science_project"] [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} + +[tool.pytest] +python_files = "test_*.py" +testpaths = ["science_project/tests"] diff --git a/science_project/__init__.py b/science_project/__init__.py index e69de29..aaab658 100644 --- a/science_project/__init__.py +++ b/science_project/__init__.py @@ -0,0 +1 @@ +from .main import add_one diff --git a/science_project/main.py b/science_project/main.py new file mode 100644 index 0000000..c929f88 --- /dev/null +++ b/science_project/main.py @@ -0,0 +1,2 @@ +def add_one(number): + return number + 1 diff --git a/science_project/tests/__init__.py b/science_project/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/science_project/tests/test_project.py b/science_project/tests/test_project.py new file mode 100644 index 0000000..374b50f --- /dev/null +++ b/science_project/tests/test_project.py @@ -0,0 +1,7 @@ +import pytest +from .. import add_one + + +@pytest.mark.parametrize("x, y", [(1, 2), (2, 3), (3, 4)]) +def test_add_one(x, y): + assert y == add_one(x)