pangeo-forge-recipes icon indicating copy to clipboard operation
pangeo-forge-recipes copied to clipboard

Add unit tests for recipe functions

Open rabernat opened this issue 4 years ago • 2 comments

As discussed in https://github.com/pangeo-forge/pangeo-forge-recipes/pull/171#issuecomment-883546066, the recent refactoring of the XarrayZarrRecipe class has made it more modular, in the sense that most of the key functions can be run without instantiating a big Recipe class and executing the whole recipe. This means we can have unit tests for all of these individual functions to verify that they do exactly what is expected of them. This would complement the more holistic integration-style tests we currently have for XarrayZarrRecipe. It might also provide a path for reducing our test suite cost while maintaining high coverage. (It currently takes > 10 minutes to run all the tests.)

rabernat avatar Jul 21 '21 12:07 rabernat

Just noting that I'm very interested in expanding my testing knowledge/competency by working on this. If anyone else gets started on it before I do, please ping me as I'd love to help out with it.

cisaacstern avatar Jul 26 '21 17:07 cisaacstern

Now that #219 has been merged, it should be much easier to implement unit tests. This is because all of the "work" of the recipe now happens in standalone functions, e.g.

prepare_target(config=recipe)

We should revisit this issue now. To begin, I would recommend that we just start a new testing folder (e.g. recipe_unit_tests) and rename the existing one to recipe_integration_tests, which is basically what they are. The unit tests would not attempt to do end-to-end runs of recipes but would rather examine each function in isolation in a very controlled way. We could develop new fixtures so these new tests are very fast and compact.

rabernat avatar Oct 25 '21 16:10 rabernat

The functions discussed here are all superseded as of 0.10.0 release, so closing this.

cisaacstern avatar Aug 25 '23 18:08 cisaacstern