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


Python config.PytestPluginManager类代码示例

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


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

示例1: test_conftestcutdir_inplace_considered

def test_conftestcutdir_inplace_considered(testdir):
    conf = testdir.makeconftest("")
    conftest = PytestPluginManager()
    conftest_setinitial(conftest, [conf.dirpath()], confcutdir=conf.dirpath())
    values = conftest._getconftestmodules(conf.dirpath())
    assert len(values) == 1
    assert values[0].__file__.startswith(str(conf))
开发者ID:sallner,项目名称:pytest,代码行数:7,代码来源:test_conftest.py

示例2: test_doubledash_considered

def test_doubledash_considered(testdir):
    conf = testdir.mkdir("--option")
    conf.ensure("conftest.py")
    conftest = PytestPluginManager()
    conftest_setinitial(conftest, [conf.basename, conf.basename])
    values = conftest._getconftestmodules(conf)
    assert len(values) == 1
开发者ID:sallner,项目名称:pytest,代码行数:7,代码来源:test_conftest.py

示例3: test_canonical_import

 def test_canonical_import(self, monkeypatch):
     mod = py.std.types.ModuleType("pytest_xyz")
     monkeypatch.setitem(py.std.sys.modules, 'pytest_xyz', mod)
     pm = PytestPluginManager()
     pm.import_plugin('pytest_xyz')
     assert pm.get_plugin('pytest_xyz') == mod
     assert pm.is_registered(mod)
开发者ID:EdgarChen,项目名称:servo,代码行数:7,代码来源:test_pluginmanager.py

示例4: test_conftest_import_order

def test_conftest_import_order(testdir, monkeypatch):
    ct1 = testdir.makeconftest("")
    sub = testdir.mkdir("sub")
    ct2 = sub.join("conftest.py")
    ct2.write("")
    def impct(p):
        return p
    conftest = PytestPluginManager()
    monkeypatch.setattr(conftest, '_importconftest', impct)
    assert conftest._getconftestmodules(sub) == [ct1, ct2]
开发者ID:aselus-hub,项目名称:pytest,代码行数:10,代码来源:test_conftest.py

示例5: test_hookrecorder_basic

def test_hookrecorder_basic(holder):
    pm = PytestPluginManager()
    pm.add_hookspecs(holder)
    rec = HookRecorder(pm)
    pm.hook.pytest_xyz(arg=123)
    call = rec.popcall("pytest_xyz")
    assert call.arg == 123
    assert call._name == "pytest_xyz"
    pytest.raises(pytest.fail.Exception, rec.popcall, "abc")
    pm.hook.pytest_xyz_noarg()
    call = rec.popcall("pytest_xyz_noarg")
    assert call._name == "pytest_xyz_noarg"
开发者ID:nicoddemus,项目名称:pytest,代码行数:12,代码来源:test_pytester.py

示例6: test_immediate_initialiation_and_incremental_are_the_same

 def test_immediate_initialiation_and_incremental_are_the_same(self, basedir):
     conftest = PytestPluginManager()
     len(conftest._path2confmods)
     conftest._getconftestmodules(basedir)
     snap1 = len(conftest._path2confmods)
     # assert len(conftest._path2confmods) == snap1 + 1
     conftest._getconftestmodules(basedir.join("adir"))
     assert len(conftest._path2confmods) == snap1 + 1
     conftest._getconftestmodules(basedir.join("b"))
     assert len(conftest._path2confmods) == snap1 + 2
开发者ID:sallner,项目名称:pytest,代码行数:10,代码来源:test_conftest.py

示例7: test_register_imported_modules

 def test_register_imported_modules(self):
     pm = PytestPluginManager()
     mod = py.std.types.ModuleType("x.y.pytest_hello")
     pm.register(mod)
     assert pm.is_registered(mod)
     values = pm.get_plugins()
     assert mod in values
     pytest.raises(ValueError, "pm.register(mod)")
     pytest.raises(ValueError, lambda: pm.register(mod))
     # assert not pm.is_registered(mod2)
     assert pm.get_plugins() == values
开发者ID:EdgarChen,项目名称:servo,代码行数:11,代码来源:test_pluginmanager.py

示例8: test_conftestcutdir

def test_conftestcutdir(testdir):
    conf = testdir.makeconftest("")
    p = testdir.mkdir("x")
    conftest = PytestPluginManager()
    conftest_setinitial(conftest, [testdir.tmpdir], confcutdir=p)
    values = conftest._getconftestmodules(p)
    assert len(values) == 0
    values = conftest._getconftestmodules(conf.dirpath())
    assert len(values) == 0
    assert conf not in conftest._conftestpath2mod
    # but we can still import a conftest directly
    conftest._importconftest(conf)
    values = conftest._getconftestmodules(conf.dirpath())
    assert values[0].__file__.startswith(str(conf))
    # and all sub paths get updated properly
    values = conftest._getconftestmodules(p)
    assert len(values) == 1
    assert values[0].__file__.startswith(str(conf))
开发者ID:sallner,项目名称:pytest,代码行数:18,代码来源:test_conftest.py

示例9: test_basic_init

 def test_basic_init(self, basedir):
     conftest = PytestPluginManager()
     p = basedir.join("adir")
     assert conftest._rget_with_confmod("a", p)[1] == 1
开发者ID:sallner,项目名称:pytest,代码行数:4,代码来源:test_conftest.py


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