-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SMRF test suite - Rework base class.
Sweeping rework of the SMRFTestCase class, breaking the setUpClass into chunks to enable overwriting of inheriting classes. Also adds a new method to copy the SMRF wide base config and adapt for specific cases.
- Loading branch information
Showing
14 changed files
with
99 additions
and
208 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
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
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
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
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 |
---|---|---|
@@ -1,47 +1,19 @@ | ||
import os | ||
import shutil | ||
|
||
from inicheck.tools import get_user_config | ||
|
||
import smrf | ||
from smrf.tests.smrf_test_case import SMRFTestCase | ||
|
||
|
||
class SMRFTestCaseLakes(SMRFTestCase): | ||
""" | ||
The base test case for SMRF that will load in the configuration file | ||
and store as the base config. Also will remove the output directory | ||
upon tear down. | ||
Runs the short simulation over reynolds mountain east | ||
""" | ||
|
||
test_dir = SMRFTestCase.test_dir.joinpath('Lakes') | ||
config_file = os.path.join(test_dir, 'config.ini') | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
""" | ||
Runs the short simulation over reynolds mountain east | ||
""" | ||
|
||
base = os.path.dirname(smrf.__file__) | ||
cls.test_dir = os.path.join(base, 'tests', 'Lakes') | ||
cls.config_file = os.path.join(cls.test_dir, 'config.ini') | ||
|
||
# read in the base configuration | ||
cls.base_config = get_user_config(cls.config_file, modules='smrf') | ||
super().setUpClass() | ||
|
||
cls.gold = os.path.abspath(os.path.join(cls.test_dir, 'gold_hrrr')) | ||
cls.gold = cls.test_dir.joinpath('gold_hrrr') | ||
cls.output = os.path.join(cls.test_dir, 'output') | ||
|
||
# Remove any potential files to ensure fresh run | ||
if os.path.isdir(cls.output): | ||
shutil.rmtree(cls.output) | ||
|
||
# create the output dir | ||
os.makedirs(cls.output, exist_ok=True) | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
""" | ||
Clean up the output directory | ||
""" | ||
folder = os.path.join(cls.base_config.cfg['output']['out_location']) | ||
if os.path.exists(folder): | ||
shutil.rmtree(folder) |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.