Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
g4brielvs committed Jan 24, 2024
1 parent ae34738 commit d18e15d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: docs

on:
push:
branches:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish Python 🐍 distribution 📦 to PyPI

on: push
on:
push:
tags:
- '*'

jobs:
build:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: tests

on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
pip install ruff
pip install pytest pytest-cov
- name: Lint with Ruff
run: |
pip install ruff
ruff --output-format=github .
continue-on-error: true
- name: Test with pytest
run: |
pytest
14 changes: 14 additions & 0 deletions tests/test_raster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest
from pydantic import ValidationError

from blackmarble.raster import bm_raster


def test_raster_validate_call():
with pytest.raises(ValidationError):
bm_raster()


def test_raster_validate_gdf():
with pytest.raises(ValidationError):
bm_raster(roi="geodataframe") # wrong type
8 changes: 8 additions & 0 deletions tests/test_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pytest

from blackmarble.types import Product


def test_fails_product():
with pytest.raises(ValueError):
Product("blackmarblepy")

0 comments on commit d18e15d

Please sign in to comment.