Add function to run both the numba and pure python versions of some function #402
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in #241 and proposed in #241 (comment), we can write a function that takes a numba-wrapped function, and automatically runs both the numba version and the unwrapped pure python version. For testing these numba-wrapped functions, it is necessary to run the pure python version to trigger the code coverage.
I've added a fixture to
tests/conftest.py
, which returns such a function for some generic wrapped function in, e.g.,dsp
. I've also updated thefixed_pickoff_time
test to use this function as an example, which cleans up the test substantially.I'll keep this as a draft for now, as I'm curious if there's a better place to store this function or if there are any thoughts on how I'm using it. I also want to point out that it doesn't work well with
pytest.raises
, so I'm just usinginspect.unwrap
for checking if the errors are being raised for both cases.Before submitting a pull request, please make sure you've read and understood the pygama developer's guide: https://pygama.readthedocs.io/en/latest/developer.html. In particular, do not forget to: