From f1835a5fce8465ce185186e0f6ec40b610a039ee Mon Sep 17 00:00:00 2001 From: snowman2 Date: Thu, 6 Jul 2017 10:50:14 -0500 Subject: [PATCH 1/2] added skip for test to run RAPID if RAPID not installed --- tests/test_rapidpy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_rapidpy.py b/tests/test_rapidpy.py index b0a29b7..2afc10f 100644 --- a/tests/test_rapidpy.py +++ b/tests/test_rapidpy.py @@ -13,7 +13,7 @@ import os from pytz import timezone from shutil import copy - +import pytest #local import from RAPIDpy import RAPID @@ -219,6 +219,7 @@ def test_qout_same(): assert (compare_qout_files(input_qout_file, input_qout_file_cf)) +@pytest.mark.skipif(not os.path.exists(RAPID_EXE_PATH), reason='Only run if RAPID installed') def test_run_rapid_simulation(): """ Test Running RAPID Simulation From 0304d648406d1a6d05bb815f104efcfe8fc1d09c Mon Sep 17 00:00:00 2001 From: snowman2 Date: Thu, 6 Jul 2017 10:51:45 -0500 Subject: [PATCH 2/2] fix compare dataset name --- tests/test_rapidpy.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/test_rapidpy.py b/tests/test_rapidpy.py index 2afc10f..7356fde 100644 --- a/tests/test_rapidpy.py +++ b/tests/test_rapidpy.py @@ -295,10 +295,10 @@ def test_convert_file_to_be_cf_compliant_new_format_comid_lat_lon_z(): d2 = Dataset(cf_qout_file_solution) assert (d1.dimensions.keys() == d2.dimensions.keys()) assert (d1.variables.keys() == d2.variables.keys()) - assert ((d1.variables['time'][:] == d1.variables['time'][:]).all()) - assert ((d1.variables['rivid'][:] == d1.variables['rivid'][:]).all()) - assert ((d1.variables['lat'][:] == d1.variables['lat'][:]).all()) - assert ((d1.variables['lon'][:] == d1.variables['lon'][:]).all()) + assert ((d1.variables['time'][:] == d2.variables['time'][:]).all()) + assert ((d1.variables['rivid'][:] == d2.variables['rivid'][:]).all()) + assert ((d1.variables['lat'][:] == d2.variables['lat'][:]).all()) + assert ((d1.variables['lon'][:] == d2.variables['lon'][:]).all()) d1.close() d2.close() @@ -335,8 +335,8 @@ def test_convert_file_to_be_cf_compliant_new_format(): d2 = Dataset(cf_qout_file_solution) assert (d1.dimensions.keys() == d2.dimensions.keys()) assert (d1.variables.keys() == d2.variables.keys()) - assert ((d1.variables['time'][:] == d1.variables['time'][:]).all()) - assert ((d1.variables['rivid'][:] == d1.variables['rivid'][:]).all()) + assert ((d1.variables['time'][:] == d2.variables['time'][:]).all()) + assert ((d1.variables['rivid'][:] == d2.variables['rivid'][:]).all()) d1.close() d2.close() @@ -373,10 +373,10 @@ def test_convert_file_to_be_cf_compliant_original_format(): d2 = Dataset(cf_qout_file_solution) assert (d1.dimensions.keys() == d2.dimensions.keys()) assert (d1.variables.keys() == d2.variables.keys()) - assert ((d1.variables['time'][:] == d1.variables['time'][:]).all()) - assert ((d1.variables['rivid'][:] == d1.variables['rivid'][:]).all()) - assert ((d1.variables['lat'][:] == d1.variables['lat'][:]).all()) - assert ((d1.variables['lon'][:] == d1.variables['lon'][:]).all()) + assert ((d1.variables['time'][:] == d2.variables['time'][:]).all()) + assert ((d1.variables['rivid'][:] == d2.variables['rivid'][:]).all()) + assert ((d1.variables['lat'][:] == d2.variables['lat'][:]).all()) + assert ((d1.variables['lon'][:] == d2.variables['lon'][:]).all()) d1.close() d2.close() @@ -633,8 +633,8 @@ def test_cf_merge(): d2 = Dataset(cf_merge_qout_file_solution) assert (d1.dimensions.keys() == d2.dimensions.keys()) assert (d1.variables.keys() == d2.variables.keys()) - assert ((d1.variables['time'][:] == d1.variables['time'][:]).all()) - assert ((d1.variables['rivid'][:] == d1.variables['rivid'][:]).all()) + assert ((d1.variables['time'][:] == d2.variables['time'][:]).all()) + assert ((d1.variables['rivid'][:] == d2.variables['rivid'][:]).all()) d1.close() d2.close()