You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pytest is a Python testing framework, used for building automated tests
Pytest can be used for Unit Testing. Unit Testing methods focus on testing individual source code units (usually functions) to ensure they function as intended (This is often used in conjunction with continuous integration (CI) and code coverage)
Pytest can also be used for testing models. For our purposes testing model run success, we need to perform "sanity checks" rather than regular unit tests (since the output from every model run will be different)
We can build tests which check whether model results meet certain criteria
Things we may want to test:
is Qout a positive float value?
is wd_mgd a positive float value?
do the number of timesteps match expected?
is the water balance sound?
...
Process for setting up tests
pip install pytest (I've done this on deq2)
tests can live in meta_model/tests/[file_containing_test].py
Initial testing: created new branch auto_tests with the file hydr_test.py
Pytest is a Python testing framework, used for building automated tests
Process for setting up tests
pip install pytest
(I've done this on deq2)meta_model/tests/[file_containing_test].py
auto_tests
with the filehydr_test.py
_hydrd_wy.csv
fixture
is used to pull in the hydr csv data which can then be passed into multiple tests as an argumentInitial testing:
Remaining development needed:
hydr_test.py
(right nowscenario
,seg
, andCBP_EXPORT_DIR
are hard-coded for testing)meta_model/models/hsp2_cbp6/river/analyze/
04_hydr_metrics
@rburghol
The text was updated successfully, but these errors were encountered: