fatiando / harmonica

Forward modeling, inversion, and processing gravity and magnetic data
https://www.fatiando.org/harmonica
BSD 3-Clause "New" or "Revised" License
211 stars 69 forks source link

Decorate tests for Legendre functions #521

Closed santisoler closed 2 months ago

santisoler commented 3 months ago

Apply decorators to tests for the associated functions to compute the Legendre polynomials so we lower the time it takes to run the tests: mark the ones that test the Schmidt identity (running with high degrees) to require Numba JIT to be enabled, mark the other ones as use_numba so they are run with and without Numba JIT. Add low degree versions of the tests using the Schmidt identity to also check coverage with those.

santisoler commented 3 months ago

I started this PR after @indiauppal and I noticed some of the tests taking too long. After merging #505, tests on CI went from 5mins to ~23mins. I'm aiming to reduce the run times back to around 5min.

santisoler commented 3 months ago

I also noticed that the harmonica/_spherical_harmonics/legendre.py file is not being listed in the coverage report. I've checked locally and we are hitting 100% coverage on that file, but would be nice if we have it in the report too. I think as soon as we start using those functions in public modules, then they'll be included.

leouieda commented 3 months ago

What? It wasn't taking that long in the PR was it?

santisoler commented 3 months ago

It was, but we didn't notice:

leouieda commented 3 months ago

Ah wow! I keep forgetting that Harmonica runs tests without numba compilation. That's something I really don't love but can't think of a way to get the full coverage without it.