def test_umr_reload_modules(user_module): """Test that the UMR only tries to reload user modules.""" # Create user module user_module('foo3') # Create UMR umr = UserModuleReloader() # Don't reload stdlib modules import xml assert not umr.is_module_reloadable(xml, 'xml') # Don't reload third-party modules import numpy assert not umr.is_module_reloadable(numpy, 'numpy') # Reload user modules import foo3 assert umr.is_module_reloadable(foo3, 'foo3')
def test_umr_skip_cython(user_module): """ Test that the UMR doesn't try to reload modules when Cython support is active. """ # Create user module user_module('foo') # Activate Cython support os.environ['SPY_RUN_CYTHON'] = 'True' # Create UMR umr = UserModuleReloader() import foo assert umr.is_module_reloadable(foo, 'foo') == False # Deactivate Cython support os.environ['SPY_RUN_CYTHON'] = 'False'