Open ilaflott opened 3 weeks ago
There are two possible solutions to this issue as written. Ideally in the long run, both of these tests would exist- as one failing (but not the other) would instantly point us towards/away from click
machinery being part of the problem
click.testing.CliRunner
This approach literally tests the CLI call shown in the bash script above, and would go in fre/tests/test_fre_cmor_cli.py
. This soluition must not use subprocess.run
to execute the call, as this is what CliRunner
is for.
from fre import cmor
This approach would test the equivalent functionality of the CLI call shown in the bash script above, using standard module imports and python packaging structure. It would not use the CliRunner
, as it's testing the module functionality and not the CLI one. This would be a test written in a file like fre/cmor/tests/test_fre_cmor_run.py
Good examples / tricks within Cole Harvey's tests: https://github.com/NOAA-GFDL/fre-workflows/tree/main/data_lineage/tests
We should avoid what i did with time averaging tests: https://github.com/NOAA-GFDL/fre-cli/tree/main/fre/app/generate_time_averages/tests
Dana / my tests for remap-pp-components
and regrid_xy.py
aren't too bad and may end up close to what we come up with for cmor
: https://github.com/NOAA-GFDL/fre-workflows/tree/main/app/regrid-xy/t https://github.com/NOAA-GFDL/fre-workflows/tree/main/app/remap-pp-components/t
two examples in fre-workflows
' regrid_xy
to study for checking for array of characters v strings.
question- is this leading to a (false?) diff of 1 reported by nccmp -m
on identical metadata fields in two diff netcdf files
The following script shows a working example of a
fre cmor run
call. Note that this script only illustrates usage- probably wont work out of the box for everyone:The
stdout
produced byfre cmor run
itself should look something like:the metadata differences introduced: