forked from mom-ocean/MOM5
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test case to check that expected run outputs exist.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
from __future__ import print_function | ||
|
||
from model_test_setup import ModelTestSetup | ||
|
||
import os | ||
import sys | ||
import shutil | ||
|
||
from test_run import tests as experiments | ||
|
||
class TestRunOutputs(ModelTestSetup): | ||
""" | ||
Check the output of all runs only. Don't actually do the runs. | ||
""" | ||
|
||
# Run tests in parallel. | ||
# Run with nosetests test_run.py --processes=<n> | ||
_multiprocess_can_split_ = True | ||
|
||
def __init__(self): | ||
super(TestRunOutputs, self).__init__() | ||
|
||
def check_run_output(self, key): | ||
|
||
output_filename = os.path.join(self.work_dir, key, 'fms.out') | ||
assert(os.path.exists(output_filename)) | ||
|
||
with open(output_filename) as f: | ||
s = f.read() | ||
|
||
assert('NOTE: Natural end-of-script for experiment {} with model {}.'.format(key, experiments[key][0][0]) in s) | ||
|
||
def test_experiments(self): | ||
for k in experiments.keys(): | ||
yield self.check_run_output, k |