dtcenter / METplus

Python scripting infrastructure for MET tools.
https://metplus.readthedocs.io
Apache License 2.0
97 stars 37 forks source link

feature #2253 print error logs from conftest #2358

Closed John-Sharples closed 12 months ago

John-Sharples commented 12 months ago

Adds functionality to conftest to print out any error logs captured by the mock logger. Only applies to wrapper tests that use metplus_config fixture. This shouldn't cause any change in behaviour on successful test run, but is useful when developing tests and debugging test failures. On failed tests, where an error is logged from a wrapper, should produce output similar to the following in the test teardown:

---------------------------- Captured stdout setup -----------------------------
Parsing config file: /METplus/parm/metplus_config/defaults.conf
Parsing config file: /METplus/internal/tests/pytests/minimum_pytest.conf
Logging to /METplus/internal/tests/pytests/test_output/781808e5/logs/metplus.log
--------------------------- Captured stdout teardown ---------------------------
Tests raised the following errors:
(extract_tiles_wrapper.py:128) Must set FCST_EXTRACT_TILES_INPUT_DIR to run ExtractTiles wrapper
(extract_tiles_wrapper.py:140) FCST_EXTRACT_TILES_OUTPUT_TEMPLATE must be set.
(extract_tiles_wrapper.py:128) Must set OBS_EXTRACT_TILES_INPUT_DIR to run ExtractTiles wrapper
(extract_tiles_wrapper.py:140) OBS_EXTRACT_TILES_OUTPUT_TEMPLATE must be set.
(regrid_data_plane_wrapper.py:109) FCST_REGRID_DATA_PLANE_OUTPUT_TEMPLATE must be set if FCST_REGRID_DATA_PLANE_RUN is True
(regrid_data_plane_wrapper.py:131) OBS_REGRID_DATA_PLANE_OUTPUT_TEMPLATE must be set if OBS_REGRID_DATA_PLANE_RUN is True
(extract_tiles_wrapper.py:332) Could not find TC_STAT file: /METplus/internal/tests/pytests/input/filter_20141214.tcst

Pull Request Testing

Pull Request Checklist

See the METplus Workflow for details.