Skip to content

Commit

Permalink
Merge pull request #1 from climate-service-center/tests
Browse files Browse the repository at this point in the history
Tests
  • Loading branch information
larsbuntemeyer authored Oct 21, 2024
2 parents 8a21727 + feeb7a6 commit bd9aaf7
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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)"

4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ packages = ["science_project"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.pytest]
python_files = "test_*.py"
testpaths = ["science_project/tests"]
1 change: 1 addition & 0 deletions science_project/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .main import add_one
2 changes: 2 additions & 0 deletions science_project/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def add_one(number):
return number + 1
Empty file.
7 changes: 7 additions & 0 deletions science_project/tests/test_project.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit bd9aaf7

Please sign in to comment.