Beispiel #1
0
def test_plugin_exists(plugin_package):
    """Test that an existing plugin returns its own plugin name"""
    plugin_name = pyplugs.names(plugin_package)[0]
    assert pyplugs.info(plugin_package, plugin_name).plugin_name == plugin_name
Beispiel #2
0
def test_call_existing_plugin(plugin_package):
    """Test that calling a test-plugin works, and returns a string"""
    plugin_name = pyplugs.names(plugin_package)[0]
    return_value = pyplugs.call(plugin_package, plugin_name)
    assert isinstance(return_value, str)
Beispiel #3
0
def test_package_non_existing():
    """Test that a non-existent package raises an appropriate error"""
    with pytest.raises(pyplugs.UnknownPackageError):
        pyplugs.names("pyplugs.non_existent")
Beispiel #4
0
def test_package_empty():
    """Test that names() does not find any plugins in the pyplugs-package"""
    lib_plugins = pyplugs.names("pyplugs")
    assert len(lib_plugins) == 0
Beispiel #5
0
def test_package_not_empty(plugin_package):
    """Test that names() finds some plugins in package"""
    plugins = pyplugs.names(plugin_package)
    assert len(plugins) > 0
Beispiel #6
0
def test_names_factory(plugin_package):
    """Test that the names factory can retrieve names in package"""
    names = pyplugs.names_factory(plugin_package)
    factory_names = names()
    pyplugs_names = pyplugs.names(plugin_package)
    assert factory_names == pyplugs_names
Beispiel #7
0
def test_ordered_plugin(plugin_package):
    """Test that order of plugins can be customized"""
    plugin_names = pyplugs.names(plugin_package)
    assert plugin_names[0] == "plugin_first"
    assert plugin_names[-1] == "plugin_last"