Esempio n. 1
0
def get_pandoc_version():
    """Gets the Pandoc version if Pandoc is installed.
    
    If the minimal version is not met, it will probe Pandoc for its version, cache it and return that value.
    If the minimal version is met, it will return the cached version and stop probing Pandoc 
    (unless :func:`clean_cache()` is called).

    Raises
    ------
    PandocMissing
      If pandoc is unavailable.
    """
    global __version

    if __version is None:
        if not is_cmd_found('pandoc'):
            raise PandocMissing()

        out = subprocess.check_output(['pandoc', '-v'],
                                      universal_newlines=True)
        out_lines = out.splitlines()
        version_pattern = re.compile(r"^\d+(\.\d+){1,}$")
        for tok in out_lines[0].split():
            if version_pattern.match(tok):
                __version = tok
                break
    return __version
Esempio n. 2
0
def get_pandoc_version():
    """Gets the Pandoc version if Pandoc is installed.

    If the minimal version is not met, it will probe Pandoc for its version, cache it and return that value.
    If the minimal version is met, it will return the cached version and stop probing Pandoc 
    (unless :func:`clean_cache()` is called).

    Raises
    ------
    PandocMissing
      If pandoc is unavailable.
    """
    global __version

    if __version is None:
        if not is_cmd_found('pandoc'):
            raise PandocMissing()

        out = subprocess.check_output(['pandoc', '-v'],
                                      universal_newlines=True)
        out_lines = out.splitlines()
        version_pattern = re.compile(r"^\d+(\.\d+){1,}$")
        for tok in out_lines[0].split():
            if version_pattern.match(tok):
                __version = tok
                break
    return __version
Esempio n. 3
0
def onlyif_cmds_exist(*commands):
    """
    Decorator to skip test when at least one of `commands` is not found.
    """
    for cmd in commands:
        if not is_cmd_found(cmd):
            return skip("This test runs only if command '{0}' "
                        "is installed".format(cmd))
    return null_deco
Esempio n. 4
0
def onlyif_cmds_exist(*commands):
    """
    Decorator to skip test when at least one of `commands` is not found.
    """
    for cmd in commands:
        if not is_cmd_found(cmd):
            return skip("This test runs only if command '{0}' "
                        "is installed".format(cmd))
    return null_deco
Esempio n. 5
0
def onlyif_cmds_exist(*commands):
    """
    Decorator to skip test when at least one of `commands` is not found.
    """
    for cmd in commands:
        try:
            if not is_cmd_found(cmd):
                return skip("This test runs only if command '{0}' " "is installed".format(cmd))
        except ImportError as e:
            # is_cmd_found uses pywin32 on windows, which might not be available
            if sys.platform == "win32" and "pywin32" in e.message:
                return skip("This test runs only if pywin32 and command '{0}' " "is installed".format(cmd))
            raise e
    return null_deco
Esempio n. 6
0
def onlyif_cmds_exist(*commands):
    """
    Decorator to skip test when at least one of `commands` is not found.
    """
    for cmd in commands:
        try:
            if not is_cmd_found(cmd):
                return skip("This test runs only if command '{0}' "
                            "is installed".format(cmd))
        except ImportError as e:
            # is_cmd_found uses pywin32 on windows, which might not be available
            if sys.platform == 'win32' and 'pywin32' in str(e):
                return skip("This test runs only if pywin32 and command '{0}' "
                            "is installed".format(cmd))
            raise e
    return null_deco
Esempio n. 7
0
def onlyif_any_cmd_exists(*commands):
    """
    Decorator to skip test unless at least one of `commands` is found.
    """
    for cmd in commands:
        try:
            if is_cmd_found(cmd):
                return null_deco
        except ImportError as e:
            # is_cmd_found uses pywin32 on windows, which might not be available
            if sys.platform == 'win32' and 'pywin32' in str(e):
                return skip("This test runs only if pywin32 and commands '{0}' "
                            "are installed".format(commands))
            raise e
    return skip("This test runs only if one of the commands {0} "
                "is installed".format(commands))
Esempio n. 8
0
def onlyif_any_cmd_exists(*commands):
    """
    Decorator to skip test unless at least one of `commands` is found.
    """
    for cmd in commands:
        try:
            if is_cmd_found(cmd):
                return null_deco
        except ImportError as e:
            # is_cmd_found uses pywin32 on windows, which might not be available
            if sys.platform == 'win32' and 'pywin32' in str(e):
                return skip(
                    "This test runs only if pywin32 and commands '{0}' "
                    "are installed".format(commands))
            raise e
    return skip("This test runs only if one of the commands {0} "
                "is installed".format(commands))
Esempio n. 9
0
def get_pandoc_version():
    """Gets the Pandoc version if Pandoc is installed.
    
    If the minimal version is not met, it will probe Pandoc for its version, cache it and return that value.
    If the minimal version is met, it will return the cached version and stop probing Pandoc 
    (unless :func:`clean_cache()` is called).

    Raises
    ------
    PandocMissing
      If pandoc is unavailable.
    """
    global __version

    if __version is None:
        if not is_cmd_found('pandoc'):
            raise PandocMissing()

        out = subprocess.check_output( ['pandoc', '-v'], universal_newlines=True)
        pv_re = re.compile(r'(\d{0,3}\.\d{0,3}\.\d{0,3})')
        __version = pv_re.search(out).group(0)
    return __version
Esempio n. 10
0
def get_pandoc_version():
    """Gets the Pandoc version if Pandoc is installed.
    
    If the minimal version is not met, it will probe Pandoc for its version, cache it and return that value.
    If the minimal version is met, it will return the cached version and stop probing Pandoc 
    (unless :func:`clean_cache()` is called).

    Raises
    ------
    PandocMissing
      If pandoc is unavailable.
    """
    global __version

    if __version is None:
        if not is_cmd_found('pandoc'):
            raise PandocMissing()

        out = subprocess.check_output(['pandoc', '-v'],
                                      universal_newlines=True)
        pv_re = re.compile(r'(\d{0,3}\.\d{0,3}\.\d{0,3})')
        __version = pv_re.search(out).group(0)
    return __version
Esempio n. 11
0
have['curses'] = test_for('_curses')
have['matplotlib'] = test_for('matplotlib')
have['numpy'] = test_for('numpy')
have['pexpect'] = test_for('IPython.external.pexpect')
have['pymongo'] = test_for('pymongo')
have['pygments'] = test_for('pygments')
have['qt'] = test_for('IPython.external.qt')
have['sqlite3'] = test_for('sqlite3')
have['tornado'] = test_for('tornado.version_info', (4,0), callback=None)
have['jinja2'] = test_for('jinja2')
have['mistune'] = test_for('mistune')
have['requests'] = test_for('requests')
have['sphinx'] = test_for('sphinx')
have['jsonschema'] = test_for('jsonschema')
have['terminado'] = test_for('terminado')
have['casperjs'] = is_cmd_found('casperjs')
have['phantomjs'] = is_cmd_found('phantomjs')
have['slimerjs'] = is_cmd_found('slimerjs')

min_zmq = (2,1,11)

have['zmq'] = test_for('zmq.pyzmq_version_info', min_zmq, callback=lambda x: x())

#-----------------------------------------------------------------------------
# Test suite definitions
#-----------------------------------------------------------------------------

test_group_names = ['parallel', 'kernel', 'kernel.inprocess', 'config', 'core',
                    'extensions', 'lib', 'terminal', 'testing', 'utils',
                    'nbformat', 'qt', 'html', 'nbconvert'
                   ]
Esempio n. 12
0
have['matplotlib'] = test_for('matplotlib')
have['numpy'] = test_for('numpy')
have['pexpect'] = test_for('IPython.external.pexpect')
have['pymongo'] = test_for('pymongo')
have['pygments'] = test_for('pygments')
have['qt'] = test_for('IPython.external.qt')
have['rpy2'] = test_for('rpy2')
have['sqlite3'] = test_for('sqlite3')
have['cython'] = test_for('Cython')
have['oct2py'] = test_for('oct2py')
have['tornado'] = test_for('tornado.version_info', (3,1,0), callback=None)
have['jinja2'] = test_for('jinja2')
have['azure'] = test_for('azure')
have['requests'] = test_for('requests')
have['sphinx'] = test_for('sphinx')
have['casperjs'] = is_cmd_found('casperjs')

min_zmq = (2,1,11)

have['zmq'] = test_for('zmq.pyzmq_version_info', min_zmq, callback=lambda x: x())

#-----------------------------------------------------------------------------
# Test suite definitions
#-----------------------------------------------------------------------------

test_group_names = ['parallel', 'kernel', 'kernel.inprocess', 'config', 'core',
                    'extensions', 'lib', 'terminal', 'testing', 'utils',
                    'nbformat', 'qt', 'html', 'nbconvert'
                   ]

class TestSection(object):
Esempio n. 13
0
have['curses'] = test_for('_curses')
have['matplotlib'] = test_for('matplotlib')
have['numpy'] = test_for('numpy')
have['pexpect'] = test_for('IPython.external.pexpect')
have['pymongo'] = test_for('pymongo')
have['pygments'] = test_for('pygments')
have['qt'] = test_for('IPython.external.qt')
have['rpy2'] = test_for('rpy2')
have['sqlite3'] = test_for('sqlite3')
have['cython'] = test_for('Cython')
have['tornado'] = test_for('tornado.version_info', (3,1,0), callback=None)
have['jinja2'] = test_for('jinja2')
have['requests'] = test_for('requests')
have['sphinx'] = test_for('sphinx')
have['casperjs'] = is_cmd_found('casperjs')

min_zmq = (2,1,11)

have['zmq'] = test_for('zmq.pyzmq_version_info', min_zmq, callback=lambda x: x())

#-----------------------------------------------------------------------------
# Test suite definitions
#-----------------------------------------------------------------------------

test_group_names = ['parallel', 'kernel', 'kernel.inprocess', 'config', 'core',
                    'extensions', 'lib', 'terminal', 'testing', 'utils',
                    'nbformat', 'qt', 'html', 'nbconvert'
                   ]

class TestSection(object):
Esempio n. 14
0
have['numpy'] = test_for('numpy')
have['pexpect'] = test_for('IPython.external.pexpect')
have['pymongo'] = test_for('pymongo')
have['pygments'] = test_for('pygments')
have['qt'] = test_for('IPython.external.qt')
have['rpy2'] = test_for('rpy2')
have['sqlite3'] = test_for('sqlite3')
have['cython'] = test_for('Cython')
have['tornado'] = test_for('tornado.version_info', (3,1,0), callback=None)
have['jinja2'] = test_for('jinja2')
have['mistune'] = test_for('mistune')
have['requests'] = test_for('requests')
have['sphinx'] = test_for('sphinx')
have['jsonschema'] = test_for('jsonschema')
have['jsonpointer'] = test_for('jsonpointer')
have['casperjs'] = is_cmd_found('casperjs')
have['phantomjs'] = is_cmd_found('phantomjs')
have['slimerjs'] = is_cmd_found('slimerjs')

min_zmq = (2,1,11)

have['zmq'] = test_for('zmq.pyzmq_version_info', min_zmq, callback=lambda x: x())

#-----------------------------------------------------------------------------
# Test suite definitions
#-----------------------------------------------------------------------------

test_group_names = ['parallel', 'kernel', 'kernel.inprocess', 'config', 'core',
                    'extensions', 'lib', 'terminal', 'testing', 'utils',
                    'nbformat', 'qt', 'html', 'nbconvert'
                   ]
Esempio n. 15
0
have["pexpect"] = test_for("IPython.external.pexpect")
have["pymongo"] = test_for("pymongo")
have["pygments"] = test_for("pygments")
have["qt"] = test_for("IPython.external.qt")
have["rpy2"] = test_for("rpy2")
have["sqlite3"] = test_for("sqlite3")
have["cython"] = test_for("Cython")
have["oct2py"] = test_for("oct2py")
have["tornado"] = test_for("tornado.version_info", (3, 1, 0), callback=None)
have["jinja2"] = test_for("jinja2")
have["wx"] = test_for("wx")
have["wx.aui"] = test_for("wx.aui")
have["azure"] = test_for("azure")
have["requests"] = test_for("requests")
have["sphinx"] = test_for("sphinx")
have["casperjs"] = is_cmd_found("casperjs")

min_zmq = (2, 1, 11)

have["zmq"] = test_for("zmq.pyzmq_version_info", min_zmq, callback=lambda x: x())

# -----------------------------------------------------------------------------
# Test suite definitions
# -----------------------------------------------------------------------------

test_group_names = [
    "parallel",
    "kernel",
    "kernel.inprocess",
    "config",
    "core",
Esempio n. 16
0
have = {'curses': test_for('_curses'),
        'matplotlib': test_for('matplotlib'),
        'numpy': test_for('numpy'),
        'pexpect': test_for('IPython.external.pexpect'),
        'pymongo': test_for('pymongo'),
        'pygments': test_for('pygments'),
        'qt': test_for('IPython.external.qt'),
        'rpy2': test_for('rpy2'),
        'sqlite3': test_for('sqlite3'),
        'cython': test_for('Cython'),
        'oct2py': test_for('oct2py'),
        'tornado': test_for('tornado.version_info', (3, 1, 0), callback=None),
        'jinja2': test_for('jinja2'),
        'requests': test_for('requests'),
        'sphinx': test_for('sphinx'),
        'casperjs': is_cmd_found('casperjs')}

min_zmq = (2,1,11)

have['zmq'] = test_for('zmq.pyzmq_version_info', min_zmq, callback=lambda x: x())

#-----------------------------------------------------------------------------
# Test suite definitions
#-----------------------------------------------------------------------------

test_group_names = ['parallel', 'kernel', 'kernel.inprocess', 'config', 'core',
                    'extensions', 'lib', 'terminal', 'testing', 'utils',
                    'nbformat', 'qt', 'html', 'nbconvert'
                   ]

class TestSection(object):