本文整理匯總了Python中_pytest.core.PluginManager.consider_setuptools_entrypoints方法的典型用法代碼示例。如果您正苦於以下問題:Python PluginManager.consider_setuptools_entrypoints方法的具體用法?Python PluginManager.consider_setuptools_entrypoints怎麽用?Python PluginManager.consider_setuptools_entrypoints使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類_pytest.core.PluginManager
的用法示例。
在下文中一共展示了PluginManager.consider_setuptools_entrypoints方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_consider_setuptools_instantiation
# 需要導入模塊: from _pytest.core import PluginManager [as 別名]
# 或者: from _pytest.core.PluginManager import consider_setuptools_entrypoints [as 別名]
def test_consider_setuptools_instantiation(self, monkeypatch):
pkg_resources = py.test.importorskip("pkg_resources")
def my_iter(name):
assert name == "pytest11"
class EntryPoint:
name = "pytest_mytestplugin"
dist = None
def load(self):
class PseudoPlugin:
x = 42
return PseudoPlugin()
return iter([EntryPoint()])
monkeypatch.setattr(pkg_resources, 'iter_entry_points', my_iter)
pluginmanager = PluginManager()
pluginmanager.consider_setuptools_entrypoints()
plugin = pluginmanager.getplugin("mytestplugin")
assert plugin.x == 42
示例2: test_consider_setuptools_not_installed
# 需要導入模塊: from _pytest.core import PluginManager [as 別名]
# 或者: from _pytest.core.PluginManager import consider_setuptools_entrypoints [as 別名]
def test_consider_setuptools_not_installed(self, monkeypatch):
monkeypatch.setitem(py.std.sys.modules, 'pkg_resources',
py.std.types.ModuleType("pkg_resources"))
pluginmanager = PluginManager()
pluginmanager.consider_setuptools_entrypoints()