-
Notifications
You must be signed in to change notification settings - Fork 219
Testing
Before making a Pull Request to the ESCMI/CIME repository on GitHub, test your changes.
- Testing changes
- Testing methods
- Code Quality
- Continuous Intgeration Testing
- Changes to Fortran or to the test scripts in SystemTests
CIME splits it's testing into two categories unit and sys.
The unit category covers both doctests and unit tests. While the sys category covers regression tests. The tests are named accordingly e.g. unit tests are found as CIME/tests/test_unit*.
There are two possible methods to run these tests.
CIME also supports running tests using pytest. By using pytest coverage reports are automatically generated.
To get started install pytest and pytest-cov.
pip install pytest pytest-cov
# or
# conda install -c conda-forge pytest pytest-covpytestpytest CIME/tests/test_unit*
# or
pytest CIME/tests/test_sys*pytest CIME/tests/test_unit_case.pypytest CIME/tests/test_unit_case.py::TestCaseSubmit::test_check_caseThe scripts_regression_tests.py script is located under CIME/tests.
You can pass either the module name or the file path of a test.
python CIME/tests/scripts_regression_tests.pypython CIME/tests/scripts_regression_tests.py CIME/tests/test_unit*
# or
python CIME/tests/scripts_regression_tests.py CIME/tests/test_sys*python CIME/tests/scripts_regression_tests.py CIME.tests.test_unit_casepython CIME/tests/scripts_regression_tests.py CIME.tests.test_unit_case.TestCaseSubmit.test_check_caseTo ensure code quality we require all code to be linted by pylint and formatted using black. We run a few other tools to check XML formatting, end of file and trailing white spaces.
To ensure consistency when running these tools we require the use of pre-commit.
pip install pre_commit
# or
# conda install -c conda-forge pre_commitpre-commit run -aIf you install these scripts then pre-commit will automatically run on git commit.
pre-commit installCIME uses Jenkins to run scripts_regression_tests nightly. Latest results are on http://my.cdash.org/index.php?project=CIME.
If there are changes to Fortran code in CIME or to the scripts in /utils/python/CIME/SystemTests, you must run the cime_developer tests.
-
Run the X and A system tests with ::
./create_test cime_developer
Note: The list of cime_developer tests is defined in cime/scripts/lib/update_acme_tests.py
As noted under "Changes to python", the cime_developer system tests are run automatically if you run scripts_regression_tests.py without the --fast argument - so if you have already run that, you do not have to separately run the above command.
- If any changes have been made to Fortran code in share/ or driver_cpl/, then run cime unit tests: From the top-level directory in cime, follow the instructions in README.unit_testing (currently only works out-of-the-box on yellowstone).
In addition to CIME standalone testing there is testing associated with each of the CIME models - ACME and CESM. The workflows for each modeling group are a little different and are described below: