From 012bb5c6f45742cc5119a17016d76076bfdffc3d Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Sat, 13 Jun 2020 14:28:29 -0400 Subject: [PATCH 1/2] CI(mt3dusgs): Add version check in mt3dusgs test Add static method for checking current version number of a target. --- autotest/t009_test.py | 15 ++++++++++++++- pymake/usgsprograms.py | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/autotest/t009_test.py b/autotest/t009_test.py index abfd9c5c..ed568b1f 100644 --- a/autotest/t009_test.py +++ b/autotest/t009_test.py @@ -38,7 +38,20 @@ def get_example_dirs(): exclude_dirs = ['Keating', 'Keating_UZF'] - exdirs = [o for o in os.listdir(expth) + + upd = pymake.usgs_program_data() + + # exclude additional directories based on version of codes + # MODFLOW-NWT + ver = upd.get_version('mfnwt') + if ver == '1.2.0': + exclude_dirs += ['UZT_NonLin', + 'UZT_Disp_Lamb01_TVD', + 'UZT_Disp_Lamb1', + 'UZT_Disp_Lamb10'] + + # create list of example directories to test + exdirs = [o for o in sorted(os.listdir(expth)) if os.path.isdir(os.path.join(expth, o)) and o not in exclude_dirs] return exdirs diff --git a/pymake/usgsprograms.py b/pymake/usgsprograms.py index 68e332e0..70f04443 100644 --- a/pymake/usgsprograms.py +++ b/pymake/usgsprograms.py @@ -191,6 +191,26 @@ def get_precision(key): precision.append(True) return precision + @staticmethod + def get_version(key): + """ + Get the current version of the specified target + + Parameters + ---------- + key : str + Target USGS program + + Returns + ------- + version : str + current version of the specified target + + + """ + target = usgs_program_data().get_target(key) + return target.version + @staticmethod def list_targets(current=False): """ From b2c662973026098fb2fe324c1e9305351a1328fe Mon Sep 17 00:00:00 2001 From: Joseph D Hughes Date: Sat, 13 Jun 2020 15:08:51 -0400 Subject: [PATCH 2/2] CI(mt3dusgs): Add version check in mt3dusgs test Update latest_version check in t999 autotest. --- autotest/t999_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/autotest/t999_test.py b/autotest/t999_test.py index 85dafa8e..64946e42 100644 --- a/autotest/t999_test.py +++ b/autotest/t999_test.py @@ -29,10 +29,11 @@ def is_exe(fpath): def test_latest_version(): version = pymake.repo_latest_version() - test_version = '3.0' + test_version = '4.0' msg = 'returned version ({}) '.format(version) + \ - 'is not equal to defined version ({})'.format(test_version) - assert version == test_version, msg + 'is not greater than or equal to ' + \ + 'defined version ({})'.format(test_version) + assert float(version) >= float(test_version), msg return