inside dir1, execute "python setup.py build_ext --inplace" to build these modules. This test just checks the __file__ and __loader__ attributes of a module, not whether the loaded modules function correctly. """ import sys,os scriptpath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.dirname(scriptpath)) # path to cached_import.py dir1 = os.path.join(scriptpath,"dir1") dir2 = os.path.join(scriptpath,"dir2") dir3 = os.path.join(scriptpath,"dir3") sys.path.append(dir1) from cached_import import simple_finder my_importer = simple_finder() sys.meta_path.append(my_importer) import f1 import f2 import f3 sys.path.insert(0,dir2) import f4 sys.path.append(dir3) import f5 import f6 import f7 from f8 import f9 def check(modules): # For Python source files, either the source or bytecode file
inside dir1, execute "python setup.py build_ext --inplace" to build these modules. This test just checks the __file__ and __loader__ attributes of a module, not whether the loaded modules function correctly. """ import sys, os scriptpath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.dirname(scriptpath)) # path to cached_import.py dir1 = os.path.join(scriptpath, "dir1") dir2 = os.path.join(scriptpath, "dir2") dir3 = os.path.join(scriptpath, "dir3") sys.path.append(dir1) from cached_import import simple_finder my_importer = simple_finder() sys.meta_path.append(my_importer) import f1 import f2 import f3 sys.path.insert(0, dir2) import f4 sys.path.append(dir3) import f5 import f6 import f7 from f8 import f9 def check(modules):
"""Make sure we can import NumPy """ import sys, os scriptpath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.dirname(scriptpath)) # path to cached_import.py from cached_import import simple_finder sys.meta_path.append(simple_finder()) import numpy # What did we import? print numpy.__file__ print numpy.__version__ print getattr(numpy, "__loader__", None)