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)
| 264 | #----------------------------------------------------------------------------- |
| 265 | # Utility functions for decorators |
| 266 | def 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 | |
| 281 | def decorated_dummy(dec, name): |