Skip to content

Commit

Permalink
Merge pull request #233 from kafitzgerald/set_up_testing
Browse files Browse the repository at this point in the history
Add basic testing infrastructure
  • Loading branch information
jukent committed Apr 19, 2024
2 parents 443dcfa + 02e09e2 commit 08ab2ef
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ jobs:
run: |
conda list
- name: tests
run: |
python -m pytest
link-check:
runs-on: ubuntu-latest
defaults:
Expand Down
8 changes: 4 additions & 4 deletions build_envs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ dependencies:
- make
- matplotlib
- sphinx
- pip
- cmaps
- numpy
- xarray
- metpy
- pint
- pytest
- pytest-mpl
- geocat-datafiles
- pip:
- pre-commit
- scikit-learn
- pre-commit
- scikit-learn
4 changes: 4 additions & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Internal Changes
^^^^^^^^^^^^^^^^
* Remove M1 workaround for CI and tokens that are no longer needed by `Katelyn FitzGerald`_ in (:pr:`232`)

Testing
^^^^^^^
* Add basic testing infrastructure by `Katelyn FitzGerald`_ and `Julia Kent`_ in (:pr:`233`)


v2024.03.0 (March 26, 2024)
---------------------------
Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ install_requires =
setuptools
scikit-learn
metpy
tests_require =
pytest
pytest-mpl

[options.packages.find]
where = src
Expand All @@ -64,7 +67,7 @@ docs =

[tool:pytest]
python_files = test_*.py
testpaths = test
testpaths = tests

[aliases]
test = pytest
Empty file added tests/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
import matplotlib as mpl

from geocat.viz.util import truncate_colormap


def test_truncate_colormap():
cmap = mpl.colormaps['terrain']
truncated_cmap = truncate_colormap(cmap, 0.1, 0.9)

assert isinstance(truncated_cmap, mpl.colors.LinearSegmentedColormap)
assert truncated_cmap(0.0) == cmap(0.1)
assert truncated_cmap(1.0) == cmap(0.9)

0 comments on commit 08ab2ef

Please sign in to comment.