From 1077a9df3abc4f1fc3733a1b45d6eb62c88378d7 Mon Sep 17 00:00:00 2001 From: Pizzarules668 Date: Wed, 1 Nov 2023 17:58:26 -0500 Subject: [PATCH] Made tests work --- .github/workflows/python-build.yml | 11 +++-- test/test.py | 64 ++++++++++++++---------------- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index 5bbfb98..8c0aaec 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -26,9 +26,8 @@ jobs: - name: Build package run: python -m build - - name: Run pytest - uses: pavelzw/pytest-action@v2 - with: - emoji: false - verbose: false - job-summary: true + - name: Test with pytest + run: | + pip install . + pip install pytest + pytest test/* diff --git a/test/test.py b/test/test.py index 72b98b1..d9cdea5 100644 --- a/test/test.py +++ b/test/test.py @@ -1,37 +1,33 @@ -import unittest +import pytest from NWS_Weather import current_weather, predicted_weather -class TestNWSWeather(unittest.TestCase): + +def test_current_weather_station(): + # Test current_weather with station parameter + result = current_weather(station='KPVB') + assert result is not None + +def test_current_weather_lat_long(): + # Test current_weather with lat and long parameters + result = current_weather(lat=42.7339, lon=-90.4955) + assert result is not None + +def test_current_weather_zipcode(): + # Test current_weather with zipcode parameter + result = current_weather(zipcode=53818) + assert result is not None + +def test_predicted_weather_gridId(): + # Test predicted_weather with gridId parameter + result = predicted_weather(gridId='MKX', gridX=38, gridY=57) + assert result is not None + +def test_predicted_weather_lat_long(): + # Test predicted_weather with lat and long parameters + result = predicted_weather(lat=42.9104, lon=-89.3853) + assert result is not None - def test_current_weather_station(self): - # Test current_weather with station parameter - result = current_weather(station='KPVB') - self.assertIsNotNone(result) - - def test_current_weather_lat_long(self): - # Test current_weather with lat and long parameters - result = current_weather(lat=42.7339, lon=-90.4955) - self.assertIsNotNone(result) - - def test_current_weather_zipcode(self): - # Test current_weather with zipcode parameter - result = current_weather(zipcode=53818) - self.assertIsNotNone(result) - - def test_predicted_weather_gridId(self): - # Test predicted_weather with gridId parameter - result = predicted_weather(gridId='MKX', gridX=38, gridY=57) - self.assertIsNotNone(result) - - def test_predicted_weather_lat_long(self): - # Test predicted_weather with lat and long parameters - result = predicted_weather(lat=42.9104, lon=-89.3853) - self.assertIsNotNone(result) - - def test_predicted_weather_zipcode(self): - # Test predicted_weather with zipcode parameter - result = predicted_weather(zipcode=53575) - self.assertIsNotNone(result) - -if __name__ == '__main__': - unittest.main() \ No newline at end of file +def test_predicted_weather_zipcode(): + # Test predicted_weather with zipcode parameter + result = predicted_weather(zipcode=53575) + assert result is not None