Skip to content

Commit

Permalink
component_compare_move should not expect
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Sep 2, 2016
1 parent e78458d commit f3e9c9d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/create_newcase
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _main_func():

# Write out the case files
case.flush(flushall=True)
if user_mods_dir.startswith(".."):
if user_mods_dir is not None and user_mods_dir.startswith(".."):
user_mods_dir = os.path.abspath(user_mods_dir)

case.apply_user_mods(user_mods_dir)
Expand Down
6 changes: 5 additions & 1 deletion utils/python/CIME/SystemTests/system_tests_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,12 @@ def _coupler_log_indicates_run_complete(self):
return False

def _component_compare_move(self, suffix):
comments = move(self._case, suffix)
success, comments = move(self._case, suffix)
append_status(comments, sfile="TestStatus.log")
status = TEST_PASS_STATUS if success else TEST_FAIL_STATUS
with self._test_status:
self._test_status.set_status("%s_%s_%s" % (COMPARE_PHASE, suffix1, suffix2), status)
return success

def _component_compare_test(self, suffix1, suffix2):
"""
Expand Down
12 changes: 9 additions & 3 deletions utils/python/CIME/hist_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,12 @@ def move(case, suffix):
comments += " Copying '%s' to '%s'\n" % (test_hist, new_file)
shutil.copy(test_hist, new_file)

expect(num_moved > 0, "move failed: no hist files found in rundir '%s'" % rundir)
all_success = True
if num_moved == 0:
all_success = False
comments += "WARNING: No hist files found in rundir '%s'" % rundir)

return comments
return all_success, comments


def _hists_match(model, hists1, hists2, suffix1="", suffix2=""):
Expand Down Expand Up @@ -301,9 +304,11 @@ def get_extension(model, filepath):
'h'
>>> get_extension("clm","clm2_0002.h0.1850-01-06-00000.nc")
'0002.h0'
>>> get_extension("pop","PFS.f09_g16.B1850.yellowstone_intel.allactive-default.GC.c2_0_b1f2_int.pop.h.ecosys.nday1.0001-01-02.nc")
'h'
"""
basename = os.path.basename(filepath)
ext_regex = re.compile(r'.*%s[^_]*_?([0-9]{4})?[.](h.?)([.][^.]+)?[.]nc' % model)
ext_regex = re.compile(r'.*%s[^_]*_?([0-9]{4})?[.](h.?)([.].*[^.])?[.]nc' % model)

m = ext_regex.match(basename)
expect(m is not None, "Failed to get extension for file '%s'" % filepath)
Expand All @@ -312,6 +317,7 @@ def get_extension(model, filepath):
else:
result = m.group(2)


return result

def generate_baseline(case, baseline_dir=None, allow_baseline_overwrite=False):
Expand Down

0 comments on commit f3e9c9d

Please sign in to comment.