當前位置: 首頁>>代碼示例>>Python>>正文


Python PluginManager.consider_setuptools_entrypoints方法代碼示例

本文整理匯總了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
開發者ID:ProProgrammer,項目名稱:pytest,代碼行數:20,代碼來源:test_core.py

示例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()
開發者ID:ProProgrammer,項目名稱:pytest,代碼行數:7,代碼來源:test_core.py


注:本文中的_pytest.core.PluginManager.consider_setuptools_entrypoints方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。