コード例 #1
0
def test_discovery():
    """
    Tests that this plugin can be discovered via the plugins subsystem when looking for Sweeper
    :return:
    """
    assert RangeSweeper.__name__ in [
        x.__name__ for x in Plugins.discover(Sweeper)
    ]
コード例 #2
0
def test_discovery() -> None:
    """
    Tests that this plugin can be discovered via the plugins subsystem when looking for Launchers
    :return:
    """
    assert ExampleLauncher.__name__ in [
        x.__name__ for x in Plugins.discover(Launcher)
    ]
コード例 #3
0
def test_discovery() -> None:
    # This may seem weird, but it verifies that we can discover this Plugin via
    # the plugins subsystem.
    # The discover method takes a class and return all plugins that implements that class.
    # Typically we would be discovering all plugins that implementing some common interface.
    plugins = Plugins.discover(ExamplePlugin)
    # discovered plugins are actually different class objects, compare by name
    assert ExamplePlugin.__name__ in [x.__name__ for x in plugins]
コード例 #4
0
def test_discover(plugin_type, expected):
    plugins = Plugins.discover(plugin_type)
    expected_classes = [get_class(c) for c in sorted(expected)]
    for ex in expected_classes:
        assert ex in plugins
コード例 #5
0
def test_discover(plugin_type: Type[Plugin], expected: List[str]) -> None:
    plugins = Plugins.discover(plugin_type)
    expected_classes = [get_class(c) for c in sorted(expected)]
    for ex in expected_classes:
        assert ex in plugins