Skip to content

Commit

Permalink
adding nwrc check back but simpler to test for #197
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Havens committed Nov 18, 2020
1 parent f96286b commit 2623a9b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
9 changes: 7 additions & 2 deletions smrf/tests/data/test_hrrr.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from copy import deepcopy
import os
import pandas as pd
import unittest

from inicheck.tools import cast_all_variables

from smrf.framework.model_framework import run_smrf
from smrf.tests.smrf_test_case import SMRFTestCase
from smrf.tests.smrf_test_case_lakes import SMRFTestCaseLakes
from smrf.data.hrrr_grib import InputGribHRRR
from smrf.tests.nwrc_check import NWRCCheck


class TestLoadHRRR(SMRFTestCase):
Expand Down Expand Up @@ -100,6 +101,10 @@ def test_load_timestep_threaded(self):
self.compare_hrrr_gold()


@unittest.skipUnless(
NWRCCheck.in_network(),
"Skipping because we are not on the NWRC network"
)
class TestLoadHRRRLakes(SMRFTestCaseLakes):

def test_197_image_data_index(self):
Expand Down
19 changes: 19 additions & 0 deletions smrf/tests/nwrc_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import requests


class NWRCCheck(object):

HOST = '10.200.28.50/dashboard'
URL = 'http://' + HOST

@classmethod
def in_network(cls):
"""
Checks that were on the NWRC network
"""
try:
response = requests.get(cls.URL, timeout=1)
return response.ok

except requests.exceptions.RequestException:
return False

0 comments on commit 2623a9b

Please sign in to comment.