diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-13 21:50:36 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-13 21:50:36 +0900 |
commit | 5c9e13d2d6560dea0b81ea4ebbdabc2972191819 (patch) | |
tree | d106005c21e3a84f8bfef3d9e03439334180994f | |
parent | ec70e9a3ddd674ca4eb33119ec349a1060fcfbcc (diff) | |
download | buildstream-5c9e13d2d6560dea0b81ea4ebbdabc2972191819.tar.gz |
Adding test ensuring failure mode when plugin has no setup()
In the case a plugin does not provide setup() we expect a PluginError.
-rw-r--r-- | tests/plugins/basics.py | 14 | ||||
-rw-r--r-- | tests/plugins/basics/nosetup/__init__.py | 0 | ||||
-rw-r--r-- | tests/plugins/basics/nosetup/foo.py | 6 |
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/plugins/basics.py b/tests/plugins/basics.py index eeb054aa8..561c685e8 100644 --- a/tests/plugins/basics.py +++ b/tests/plugins/basics.py @@ -118,3 +118,17 @@ def test_element_wrongtype(plugin_fixture, datafiles): with pytest.raises(PluginError) as exc: factory = _ElementFactory(plugin_fixture['base'], [ os.path.join(datafiles.dirname, datafiles.basename) ]) + +# Load a factory with a plugin which fails to provide a setup() function +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'nosetup')) +def test_source_missing_setup(plugin_fixture, datafiles): + with pytest.raises(PluginError) as exc: + factory = _SourceFactory(plugin_fixture['base'], + [ os.path.join(datafiles.dirname, datafiles.basename) ]) + +# Load a factory with a plugin which fails to provide a setup() function +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'nosetup')) +def test_element_missing_setup(plugin_fixture, datafiles): + with pytest.raises(PluginError) as exc: + factory = _ElementFactory(plugin_fixture['base'], + [ os.path.join(datafiles.dirname, datafiles.basename) ]) diff --git a/tests/plugins/basics/nosetup/__init__.py b/tests/plugins/basics/nosetup/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/plugins/basics/nosetup/__init__.py diff --git a/tests/plugins/basics/nosetup/foo.py b/tests/plugins/basics/nosetup/foo.py new file mode 100644 index 000000000..a9f4c5190 --- /dev/null +++ b/tests/plugins/basics/nosetup/foo.py @@ -0,0 +1,6 @@ +# A plugin is supposed to define a setup function +# which returns the type that the plugin provides +# +# This plugin fails to do so +def useless(): + print ("Hello World") |