forked from dtcenter/METplus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature dtcenter#2253 tests for config_validate, mock logger in conftest
- Loading branch information
1 parent
1dc8099
commit cf11c7d
Showing
4 changed files
with
154 additions
and
4 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
21 changes: 21 additions & 0 deletions
21
internal/tests/pytests/util/config_validate/met_config_validate.conf
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,21 @@ | ||
//////////////////////////////////////////////////////////////////////////////// | ||
// Fake config for testing config_validate.py | ||
// | ||
censor_thresh = []; | ||
censor_val = []; | ||
cat_thresh = [ NA ]; | ||
cnt_thresh = [ NA ]; | ||
|
||
// | ||
// Forecast and observation fields to be verified | ||
// | ||
fcst = { | ||
${METPLUS_FCST_FILE_TYPE} | ||
${METPLUS_FCST_FIELD} | ||
} | ||
|
||
obs = { | ||
${METPLUS_OBS_FILE_TYPE} | ||
${METPLUS_OBS_FIELD} | ||
} | ||
//////////////////////////////////////////////////////////////////////////////// |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pytest | ||
from metplus.util.constants import DEPRECATED_DICT | ||
|
||
@pytest.mark.util | ||
def test_deprecated_dict(): | ||
""" | ||
Test that the structure of DEPRECATED_DICT is as expected. | ||
If not config_validate may give unexpected answers, and | ||
will not necessarily raise an error. | ||
""" | ||
allowed_keys = {'alt','copy','upgrade'} | ||
allowed_upgrade_values = {'ensemble'} | ||
|
||
for _, v in DEPRECATED_DICT.items(): | ||
assert isinstance(v, dict) | ||
assert set(v.keys()).issubset(allowed_keys) | ||
|
||
if 'upgrade' in v.keys(): | ||
assert v['upgrade'] in allowed_upgrade_values |