MCPcopy Create free account
hub / github.com/ipython/ipython / module_not_available

Function module_not_available

IPython/testing/decorators.py:266–278  ·  view source on GitHub ↗

Can module be imported? Returns true if module does NOT import. This is used to make a decorator to skip tests that require module to be available, but delay the 'import numpy' to test execution time.

(module)

Source from the content-addressed store, hash-verified

264#-----------------------------------------------------------------------------
265# Utility functions for decorators
266def module_not_available(module):
267 """Can module be imported? Returns true if module does NOT import.
268
269 This is used to make a decorator to skip tests that require module to be
270 available, but delay the 'import numpy' to test execution time.
271 """
272 try:
273 mod = import_module(module)
274 mod_not_avail = False
275 except ImportError:
276 mod_not_avail = True
277
278 return mod_not_avail
279
280
281def decorated_dummy(dec, name):

Callers 1

decorators.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected