Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(46)  |  Call(44)  |  Derive(0)  |  Import(2)
return imported module if it has at least "minversion" as its
__version__ attribute.  If no minversion is specified the a skip
is only triggered if the module can not be imported.
Note that version comparison only works with simple version strings
like "1.2.3" but not "1.2.3.dev1" or others.

        def importorskip(modname, minversion=None):
    """ return imported module if it has at least "minversion" as its
    __version__ attribute.  If no minversion is specified the a skip
    is only triggered if the module can not be imported.
    Note that version comparison only works with simple version strings
    like "1.2.3" but not "1.2.3.dev1" or others.
    """
    __tracebackhide__ = True
    compile(modname, '', 'eval') # to catch syntaxerrors
    try:
        __import__(modname)
    except ImportError:
        skip("could not import %r" %(modname,))
    mod = sys.modules[modname]
    if minversion is None:
        return mod
    verattr = getattr(mod, '__version__', None)
    def intver(verstring):
        return [int(x) for x in verstring.split(".")]
    if verattr is None or intver(verattr) < intver(minversion):
        skip("module %r has __version__ %r, required is: %r" %(
             modname, verattr, minversion))
    return mod
        


src/p/l/plexnet-HEAD/third_party/generic/pypy/py/test/testing/test_outcome.py   plexnet(Download)
def test_importorskip():
    from py.__.test.outcome import Skipped
    try:
        sys = py.test.importorskip("sys")
        assert sys == py.std.sys
        py.test.raises(SyntaxError, "py.test.importorskip('x y z')")
        py.test.raises(SyntaxError, "py.test.importorskip('x=y')")
        path = py.test.importorskip("py", minversion=".".join(py.__version__))
        mod = py.std.new.module("hello123")
        mod.__version__ = "1.3" 

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/test/plugin/pytest_pytester.py   plexnet(Download)
    def spawn_pytest(self, string, expect_timeout=10.0):
        pexpect = py.test.importorskip("pexpect", "2.3")
        basetemp = self.tmpdir.mkdir("pexpect")
        invoke = "%s %s" % self._getpybinargs("py.test")
        cmd = "%s --basetemp=%s %s" % (invoke, basetemp, string)

src/s/y/Sypy-HEAD/module/test_lib_pypy/ctypes_tests/support.py   Sypy(Download)
import py
import sys
import ctypes
 
py.test.importorskip("ctypes", "1.0.2")

src/n/u/nupic-linux64-HEAD/lib/python2.6/site-packages/_pytest/pytester.py   nupic-linux64(Download)
    def spawn(self, cmd, expect_timeout=10.0):
        pexpect = py.test.importorskip("pexpect", "2.4")
        if hasattr(sys, 'pypy_version_info') and '64' in py.std.platform.machine():
            pytest.skip("pypy-64 bit not supported")
        if sys.platform == "darwin":

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/rest/testing/test_directive.py   plexnet(Download)
import py
 
from py.__.rest.testing.setup import getdata
docutils = py.test.importorskip("docutils")
from py.__.rest import directive

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/process/testing/test_killproc.py   plexnet(Download)
def test_kill():
    subprocess = py.test.importorskip("subprocess")
    tmp = py.test.ensuretemp("test_kill")
    t = tmp.join("t.py")
    t.write("import time ; time.sleep(100)")

src/p/l/plexnet-HEAD/third_party/generic/pypy/pypy/tool/test/test_pytestsupport.py   plexnet(Download)
def test_expectcollect(testdir):
    py.test.importorskip("pexpect")
    conftestpath.copy(testdir.tmpdir)
    sorter = testdir.inline_runsource("""
        class ExpectTestOne:
def test_safe_filename(testdir):
    py.test.importorskip("pexpect")
    conftestpath.copy(testdir.tmpdir)
    sorter = testdir.inline_runsource("""
        class ExpectTestOne:

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/test/plugin/pytest_restdoc.py   plexnet(Download)
    def restcheck(self, path):
        py.test.importorskip("docutils")
        self.register_linkrole()
        from docutils.utils import SystemMessage
        try: 

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/rest/testing/test_rst.py   plexnet(Download)
 
""" rst generation tests
"""
import py
py.test.importorskip("docutils")

src/p/l/plexnet-HEAD/third_party/generic/pypy/py/rest/testing/test_rst2pdf.py   plexnet(Download)
from py.__.rest.testing.setup import getdata
 
docutils = py.test.importorskip("docutils")
 
def setup_module(mod):

  1 | 2 | 3 | 4  Next