Exemplo n.º 1
0
def test_funcs_factory(plugin_package):
    """Test that the funcs factory can retrieve funcs within plugin"""
    plugin_name = "plugin_parts"
    funcs = pyplugs.funcs_factory(plugin_package)
    factory_funcs = funcs(plugin_name)
    pyplugs_funcs = pyplugs.funcs(plugin_package, plugin_name)
    assert factory_funcs == pyplugs_funcs
Exemplo n.º 2
0
def add_to_class(cls):
    """Add all type converters as methods on the given class"""
    for func in pyplugs.funcs(PACKAGE, PLUGIN):
        setattr(cls, func, pyplugs.get(PACKAGE, PLUGIN, func=func))
Exemplo n.º 3
0
def test_list_funcs(plugin_package):
    """Test that funcs() finds some plugins in package"""
    plugins = pyplugs.funcs(plugin_package, "plugin_parts")
    assert len(plugins) == 3
Exemplo n.º 4
0
def test_list_funcs_with_label(plugin_package):
    """Test that funcs() can filter plugins with a label"""
    plugins = pyplugs.funcs(plugin_package, "plugin_labels", label="label")
    assert len(plugins) == 2
Exemplo n.º 5
0
def test_list_funcs_without_label(plugin_package):
    """Test that funcs() finds all plugins without a label"""
    plugins = pyplugs.funcs(plugin_package, "plugin_labels")
    assert len(plugins) == 2