Exemplo n.º 1
0
def testmod(module=None, run=True, optionflags=None):
    """
    Tests a doctest modules with numba functions. When run in nosetests, only
    populates module.__test__, when run as main, runs the doctests.
    """
    if module is None:
        mod_globals = sys._getframe(1).f_globals
        modname = mod_globals["__name__"]
        module = __import__(modname)
        # module = types.ModuleType(modname)
        # vars(module).update(mod_globals)

    fix_module_doctest_py3(module)
    doctest_support.testmod(module, run_doctests=run)
Exemplo n.º 2
0
def testmod(module=None, runit=False):
    """
    Tests a doctest modules with numba functions. When run in nosetests, only
    populates module.__test__, when run as main, runs the doctests.
    """
    if module is None:
        mod_globals = sys._getframe(1).f_globals
        modname = mod_globals['__name__']
        module = __import__(modname)
        # module = types.ModuleType(modname)
        # vars(module).update(mod_globals)
    else:
        modname = module.__name__

    fix_module_doctest_py3(module)
    doctest_support.testmod(module,
                            run_doctests=runit or modname == '__main__')
Exemplo n.º 3
0
def testmod(module=None, run=True, optionflags=0, verbosity=2):
    """
    Tests a doctest modules with numba functions. When run in nosetests, only
    populates module.__test__, when run as main, runs the doctests.

    module: the module to run the doctests in
    run: whether to run the doctests or just build a __test__ dict
    verbosity: verbosity level passed to unittest.TextTestRunner

        The defualt is 2

    optionflags: doctest options (e.g. doctest.ELLIPSIS)
    """
    if module is None:
        mod_globals = sys._getframe(1).f_globals
        modname = mod_globals['__name__']
        module = __import__(modname)

    doctest_support.testmod(
        module,
        run_doctests=run,
        optionflags=optionflags,
        verbosity=verbosity,
    )
Exemplo n.º 4
0
def testmod(module=None, run=True, optionflags=0, verbosity=2):
    """
    Tests a doctest modules with numba functions. When run in nosetests, only
    populates module.__test__, when run as main, runs the doctests.

    module: the module to run the doctests in
    run: whether to run the doctests or just build a __test__ dict
    verbosity: verbosity level passed to unittest.TextTestRunner

        The defualt is 2

    optionflags: doctest options (e.g. doctest.ELLIPSIS)
    """
    if module is None:
        mod_globals = sys._getframe(1).f_globals
        modname = mod_globals['__name__']
        module = __import__(modname)

    doctest_support.testmod(
        module,
        run_doctests=run,
        optionflags=optionflags,
        verbosity=verbosity,
    )