-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature dtcenter/METplus-Internal#24 test failure (#1895)
- Loading branch information
1 parent
30130f2
commit 6fb3394
Showing
50 changed files
with
807 additions
and
990 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
run_metplus | ||
util | ||
wrapper | ||
wrapper_a | ||
|
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 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
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,14 +1,5 @@ | ||
export METPLUS_TEST_INPUT_BASE=/d1/projects/METplus/METplus_Data | ||
export METPLUS_TEST_OUTPUT_BASE=/d1/personal/${USER}/pytest | ||
export METPLUS_TEST_MET_INSTALL_DIR=/usr/local/met-9.0 | ||
export METPLUS_TEST_MET_INSTALL_DIR=/usr/local/met | ||
#export METPLUS_TEST_MET_INSTALL_DIR=/d1/projects/MET/MET_releases/met-9.0_beta4 | ||
export METPLUS_TEST_TMP_DIR=${METPLUS_TEST_OUTPUT_BASE}/tmp | ||
#export METPLUS_TEST_TMP_DIR=/tmp | ||
export METPLUS_TEST_EXE_WGRIB2=/usr/local/bin/wgrib2 | ||
export METPLUS_TEST_EXE_CUT=/usr/bin/cut | ||
export METPLUS_TEST_EXE_TR=/usr/bin/tr | ||
export METPLUS_TEST_EXE_RM=/bin/rm | ||
export METPLUS_TEST_EXE_NCAP2=/usr/local/nco/bin/ncap2 | ||
export METPLUS_TEST_EXE_CONVERT=/usr/bin/convert | ||
export METPLUS_TEST_EXE_NCDUMP=/usr/local/bin/ncdump | ||
export METPLUS_TEST_EXE_EGREP=/bin/egrep |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import pytest | ||
|
||
from pathlib import Path | ||
import os | ||
import shutil | ||
from subprocess import run | ||
|
||
# get METplus directory relative to this file | ||
# from this script's directory, go up 4 directories | ||
METPLUS_DIR = str(Path(__file__).parents[4]) | ||
RUN_METPLUS = os.path.join(METPLUS_DIR, 'ush', 'run_metplus.py') | ||
EXAMPLE_CONF = os.path.join(METPLUS_DIR, 'parm', 'use_cases', | ||
'met_tool_wrapper', 'Example', 'Example.conf') | ||
MINIMUM_CONF = os.path.join(METPLUS_DIR, 'internal', 'tests', 'pytests', | ||
'minimum_pytest.conf') | ||
TEST_OUTPUT_DIR = os.path.join(os.environ['METPLUS_TEST_OUTPUT_BASE'], | ||
'test_output') | ||
NEW_OUTPUT_BASE = os.path.join(TEST_OUTPUT_DIR, 'run_metplus') | ||
OUTPUT_BASE_OVERRIDE = f"config.OUTPUT_BASE={NEW_OUTPUT_BASE}" | ||
|
||
@pytest.mark.run_metplus | ||
def test_run_metplus_exists(): | ||
"""! Check that run_metplus.py script exists """ | ||
assert os.path.exists(RUN_METPLUS) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'command, expected_return_code', [ | ||
([RUN_METPLUS], 2), | ||
([RUN_METPLUS, EXAMPLE_CONF], 2), | ||
([RUN_METPLUS, EXAMPLE_CONF, MINIMUM_CONF, OUTPUT_BASE_OVERRIDE], 0), | ||
] | ||
) | ||
@pytest.mark.run_metplus | ||
def test_run_metplus_check_return_code(command, expected_return_code): | ||
"""! Call run_metplus.py without various arguments and check that the | ||
expected value is returned by the script. A successful run should return | ||
0 and a failed run should return a non-zero return code, typically 2. | ||
""" | ||
process = run(command) | ||
assert process.returncode == expected_return_code | ||
|
||
if os.path.exists(NEW_OUTPUT_BASE): | ||
shutil.rmtree(NEW_OUTPUT_BASE) | ||
|
||
|
||
@pytest.mark.run_metplus | ||
def test_output_dir_is_created(): | ||
"""! Check that the test output directory was created after running tests | ||
""" | ||
assert os.path.exists(TEST_OUTPUT_DIR) |
Oops, something went wrong.