当前位置: 首页>>代码示例>>Python>>正文


Python main.Session类代码示例

本文整理汇总了Python中_pytest.main.Session的典型用法代码示例。如果您正苦于以下问题:Python Session类的具体用法?Python Session怎么用?Python Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Session类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getnode

 def getnode(self, config, arg):
     session = Session(config)
     assert "::" not in str(arg)
     p = py.path.local(arg)
     config.hook.pytest_sessionstart(session=session)
     res = session.perform_collect([str(p)], genitems=False)[0]
     config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
     return res
开发者ID:arvindchari88,项目名称:newGitTest,代码行数:8,代码来源:pytester.py

示例2: getpathnode

 def getpathnode(self, path):
     config = self.parseconfigure(path)
     session = Session(config)
     x = session.fspath.bestrelpath(path)
     config.hook.pytest_sessionstart(session=session)
     res = session.perform_collect([x], genitems=False)[0]
     config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
     return res
开发者ID:chrischeyne,项目名称:python-virtualenv,代码行数:8,代码来源:pytester.py

示例3: inline_genitems

 def inline_genitems(self, *args):
     # config = self.parseconfig(*args)
     config = self.parseconfigure(*args)
     rec = self.getreportrecorder(config)
     session = Session(config)
     config.hook.pytest_sessionstart(session=session)
     session.perform_collect()
     config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
     return session.items, rec
开发者ID:chrischeyne,项目名称:python-virtualenv,代码行数:9,代码来源:pytester.py

示例4: group_in_pytest

def group_in_pytest(group):
    from _pytest.config import _prepareconfig
    from _pytest.main import Session
    from _pytest.python import FixtureManager
    from _pytest.mark import MarkMapping
    config = _prepareconfig(args="")
    session = Session(config)
    session._fixturemanager = FixtureManager(session)
    l = [list(MarkMapping(i.keywords)._mymarks) for i
         in session.perform_collect()]
    groups = set([item for sublist in l for item in sublist])

    return group in groups
开发者ID:avgoor,项目名称:fuel-qa,代码行数:13,代码来源:run_system_test.py

示例5: test_collect_topdir

 def test_collect_topdir(self, testdir):
     p = testdir.makepyfile("def test_func(): pass")
     id = "::".join([p.basename, "test_func"])
     # XXX migrate to collectonly? (see below)
     config = testdir.parseconfig(id)
     topdir = testdir.tmpdir
     rcol = Session(config)
     assert topdir == rcol.fspath
     #rootid = rcol.nodeid
     #root2 = rcol.perform_collect([rcol.nodeid], genitems=False)[0]
     #assert root2 == rcol, rootid
     colitems = rcol.perform_collect([rcol.nodeid], genitems=False)
     assert len(colitems) == 1
     assert colitems[0].fspath == p
开发者ID:palaviv,项目名称:pytest,代码行数:14,代码来源:test_collection.py

示例6: test_hook_proxy

    def test_hook_proxy(self, testdir):
        """Test the gethookproxy function(#2016)"""
        config = testdir.parseconfig()
        session = Session(config)
        testdir.makepyfile(**{"tests/conftest.py": "", "tests/subdir/conftest.py": ""})

        conftest1 = testdir.tmpdir.join("tests/conftest.py")
        conftest2 = testdir.tmpdir.join("tests/subdir/conftest.py")

        config.pluginmanager._importconftest(conftest1)
        ihook_a = session.gethookproxy(testdir.tmpdir.join("tests"))
        assert ihook_a is not None
        config.pluginmanager._importconftest(conftest2)
        ihook_b = session.gethookproxy(testdir.tmpdir.join("tests"))
        assert ihook_a is not ihook_b
开发者ID:nicoddemus,项目名称:pytest,代码行数:15,代码来源:test_pluginmanager.py

示例7: getpathnode

    def getpathnode(self, path):
        """Return the collection node of a file.

        This is like :py:meth:`getnode` but uses :py:meth:`parseconfigure` to
        create the (configured) pytest Config instance.

        :param path: a :py:class:`py.path.local` instance of the file

        """
        config = self.parseconfigure(path)
        session = Session(config)
        x = session.fspath.bestrelpath(path)
        config.hook.pytest_sessionstart(session=session)
        res = session.perform_collect([x], genitems=False)[0]
        config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
        return res
开发者ID:marcosptf,项目名称:fedora,代码行数:16,代码来源:pytester.py

示例8: getnode

    def getnode(self, config, arg):
        """Return the collection node of a file.

        :param config: :py:class:`_pytest.config.Config` instance, see
           :py:meth:`parseconfig` and :py:meth:`parseconfigure` to
           create the configuration.

        :param arg: A :py:class:`py.path.local` instance of the file.

        """
        session = Session(config)
        assert '::' not in str(arg)
        p = py.path.local(arg)
        config.hook.pytest_sessionstart(session=session)
        res = session.perform_collect([str(p)], genitems=False)[0]
        config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
        return res
开发者ID:JanBednarik,项目名称:pytest,代码行数:17,代码来源:pytester.py

示例9: test_parsearg

    def test_parsearg(self, testdir):
        p = testdir.makepyfile("def test_func(): pass")
        subdir = testdir.mkdir("sub")
        subdir.ensure("__init__.py")
        target = subdir.join(p.basename)
        p.move(target)
        subdir.chdir()
        config = testdir.parseconfig(p.basename)
        rcol = Session(config=config)
        assert rcol.fspath == subdir
        parts = rcol._parsearg(p.basename)

        assert parts[0] ==  target
        assert len(parts) == 1
        parts = rcol._parsearg(p.basename + "::test_func")
        assert parts[0] ==  target
        assert parts[1] ==  "test_func"
        assert len(parts) == 2
开发者ID:palaviv,项目名称:pytest,代码行数:18,代码来源:test_collection.py


注:本文中的_pytest.main.Session类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。