-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refactor]: Refactor integration tests and add use_cfg
flag to run_diags()
#747
Conversation
15d3138
to
9e3f2fa
Compare
run_diags()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some review comments for areas of interest.
run_diags()
use_cfg
flag to run_diags()
046161c
to
1d99c95
Compare
Will do a final review and merge this after #766 |
- Make both files run each diagnostic parameter object one at a time - Move test utilities to `utils.py` - Fix paths in `all_sets_modified.cfg` - Update `Run.run_diags()` and `main.main()` to return parameter objects with their results after running diagnostics
- Remove `all_sets_modified.cfg` too Update `build_workflow.yml` to separate testing steps - Move `complete_run.py` to `tests/integration` - Move `_compare_images()` to `tests/integration/utils.py` - Update `testing.rst` with correct path to `complete_run.py` and `pytest`
- Remove `print_statements = True` in `all_sets.cfg` because test log output gets polluted
1d99c95
to
13547ad
Compare
@@ -408,6 +409,8 @@ def main(parameters=[]): | |||
) | |||
raise Exception(message) | |||
|
|||
return parameters_results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter_results
are now returned so that we can parse them for the results_dir
in unit/integration tests.
It is also generally useful to see the results after each diagnostic run.
…_diags()` (#747) * Refactor integration tests (_tests/integration_) * Delete `test_dataset.py` because it is a really old and incomplete test file for the legacy `Dataset` class based on CDAT * Delete `test_all_sets.py` and `all_sets_modified.cfg` because it tests for expected image counts which is redundant (`test_all_sets_image_diffs.py` does this already) * Replace `subprocess` calls with direct call to Python API for real-time test results and easier debugging * Move `complete_run.py` to `/test/integration` * Move `test_run.py` to `tests/e3sm_diags` since it is more of a unit test file * Refactor `Run` class (_run.py_) * Closes #735 * Add `use_cfg` boolean argument to `run_diags()` and `get_run_parameters()` * Add `self.cfg_path` attribute, which is set if `.cfg` file(s) are used for diagnostic runs * Add `is_cfg_file_arg_set()` property to check parser for `-d/--diags` * Rename `get_final_parameters()` to `get_run_parameters()` and refactored to smaller methods * Update CI/CD build workflow (_build_workflow.yml_) * Split up testing step into: 1) run unit tests 2) download integration test data 3) run integration tests * Easier to keep track of runtime and results
Description
Overview
This PR refactors the integration tests to improve maintainability by eliminating redundant code and making tests more readable. It also adds the
use_cfg
flag torun_diags()
. This flag determines whether to use.cfg
file(s) specified either by (1)-d/--diags
(2) default diags. The goal is to make it easier to debug only a few diagnostic sets by settinguse_cfg=False
.Changes
test_dataset.py
because it is a really old and incomplete test file for the legacyDataset
class based on CDATtest_all_sets.py
andall_sets_modified.cfg
because it tests for expected image counts which is redundant (test_all_sets_image_diffs.py
does this already)subprocess
calls with direct call to Python API for real-time test results and easier debuggingcomplete_run.py
to/test/integration
test_run.py
totests/e3sm_diags
since it is more of a unit test fileRun
class (run.py)use_cfg
boolean argument torun_diags()
andget_run_parameters()
self.cfg_path
attribute, which is set if.cfg
file(s) are used for diagnostic runsis_cfg_file_arg_set()
property to check parser for-d/--diags
get_final_parameters()
toget_run_parameters()
and refactored to smaller methodsExample script
Checklist
If applicable: