parcels icon indicating copy to clipboard operation
parcels copied to clipboard

Test suite improvements

Open VeckoTheGecko opened this issue 1 year ago • 1 comments

Currently (v3 of the codebase) the test suite takes 15+ minutes to run (windows is much more, closer to 30 mins). It would be good to reduce this, as well as bring other improvements to the test suite. I think code duplication, and "non-testing" (e.g., data setup) related code in the test suite is a pressing concern and makes it difficult to work with the test-suite.

We have 1112 tests, while xarray has 17354, yet xarray's test suite is 6 minutes. I think we can definitely improve here. From the top of my head (in order of what I think is most-> least pressing):

  • Defining a set of standard fieldsets (and other parcels related data objects) to do testing on by making them into fixtures in a conftest.py file so its scoped across the test suite
    • We have the test_data folder with datasets. I think these are only used for integration tests, with a lot of unit tests generating fieldset/grids within the tests themselves
  • Defining params appropriately to avoid unnecessary test duplication
  • Scoping fixtures appropriately (reducing set up/tear down of fixtures that are used a lot). I think this is less of an issue.

I think it would be worth investigating any additional measures xarray does to help with performance.

VeckoTheGecko avatar Sep 03 '24 16:09 VeckoTheGecko

Another improvement: When the test suite is run locally it saves a bunch of zarr and netcdf files all over the working directory. Although these are gitignored, it still clutters the workspace. Perhaps worth adjusting this so that it doesn't save output when its run via pytest (look at an env variable maybe?)

VeckoTheGecko avatar Sep 23 '24 07:09 VeckoTheGecko