Skip to content

Commit

Permalink
Add mypy tests
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Jul 24, 2023
1 parent eb66833 commit 43a3bc4
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 10 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,42 @@ jobs:
name: Run
run: pipenv run flake8 nasa_wildfires

mypy-python:
name: Static-types check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- id: setup-python
name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pipenv'

- id: install-pipenv
name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
shell: bash

- id: install-python-dependencies
name: Install Python dependencies
run: pipenv sync --dev
shell: bash

- id: mypy
name: Run mypy
run: pipenv run mypy ./nasa_wildfires --ignore-missing-imports --verbose
shell: bash

test-python:
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
name: Test
runs-on: ubuntu-latest
needs: [lint-python, mypy-python]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ repos:
hooks:
- id: mypy
additional_dependencies:
- types-requests
- types-requests
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ flake8 = "*"
sphinx = "*"
setuptools-scm = "*"
pre-commit = "*"
mypy = "*"
types-requests = "*"

[packages]
requests = "*"
Expand Down
67 changes: 61 additions & 6 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions nasa_wildfires/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
REGION_LIST = list(REGION_DICT.keys())


def get_modis(region: str = "global", time_range: str = "24h") -> geojson.FeatureCollection:
def get_modis(
region: str = "global", time_range: str = "24h"
) -> geojson.FeatureCollection:
"""
Hotspots detected by the MODIS satellite. Defaults to the world in a recent 24-hour period.
Expand All @@ -21,7 +23,9 @@ def get_modis(region: str = "global", time_range: str = "24h") -> geojson.Featur
return geojson.FeatureCollection(features)


def get_viirs_suomi(region: str = "global", time_range: str = "24h") -> geojson.FeatureCollection:
def get_viirs_suomi(
region: str = "global", time_range: str = "24h"
) -> geojson.FeatureCollection:
"""
Hotspots detected by the VIIRS Suomi-NPP (S-NPP) satellite. Defaults to the world in a recent 24-hour period.
Expand All @@ -34,7 +38,9 @@ def get_viirs_suomi(region: str = "global", time_range: str = "24h") -> geojson.
return geojson.FeatureCollection(features)


def get_viirs_noaa(region: str = "global", time_range: str = "24h") -> geojson.FeatureCollection:
def get_viirs_noaa(
region: str = "global", time_range: str = "24h"
) -> geojson.FeatureCollection:
"""
Hotspots detected by the VIIRS NOAA-20 satellite. Defaults to the world in a recent 24-hour period.
Expand Down

0 comments on commit 43a3bc4

Please sign in to comment.