test_examples.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:parglare 作者: igordejanovic 项目源码 文件源码
def test_examples():

    examples_pat = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                                '../../examples/*/*.py')

    # Filter out __init__.py
    examples = [f for f in glob.glob(examples_pat)
                if not any([x in f for x in ['__init__.py',
                                             'molecular']])]
    for e in examples:
        example_dir = os.path.dirname(e)
        sys.path.insert(0, example_dir)
        (module_name, _) = os.path.splitext(os.path.basename(e))
        (module_file, module_path, desc) = \
            imp.find_module(module_name, [example_dir])

        m = imp.load_module(module_name, module_file, module_path, desc)

        if hasattr(m, 'main'):
            m.main(debug=False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号