Something like this might work:
from numba import autojit
def autojit_except_when_unit_testing(func):
if UNIT_TESTING:
return func
return autojit(func)
Possibly also bump numba's issues regarding caching, as this is a pretty important use case. I would normally be pretty hesitant to run unit tests and production code in such different environments, but unit tests that take forever don't get run as often. You should almost certainly test with numba as well, just less often.