diff --git a/runtests.py b/runtests.py index 9c37cc9970b..43dc271d55a 100755 --- a/runtests.py +++ b/runtests.py @@ -5,7 +5,13 @@ if bool(os.environ.get('NUMBA_USE_TYPEGUARD')): # The typeguard import hook must be installed prior to importing numba. # Therefore, this cannot be part of the numba package. - from typeguard.importhook import install_import_hook + try: + # version 3+ exports this at the top level + from typeguard import install_import_hook + except ImportError: + # try location for version 2.x + from typeguard.importhook import install_import_hook + install_import_hook(packages=['numba']) # ensure full tracebacks are available and no help messages appear in test mode