diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-13 21:56:56 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-11-13 21:56:56 +0900 |
commit | cdddd8adba09fe4b0a71e7a13f5c2b9b12c1108b (patch) | |
tree | 65c1bcc6fd918c747f98c77548b27e33ac01f8ab /tests/plugins | |
parent | 4be7facd7f7a13a81fe5f66dc071c9a0c543698e (diff) | |
download | buildstream-cdddd8adba09fe4b0a71e7a13f5c2b9b12c1108b.tar.gz |
Adding test ensuring failure mode when plugin's setup is not a function
In the case a plugin's setup is not a function we expect a PluginError.
Diffstat (limited to 'tests/plugins')
-rw-r--r-- | tests/plugins/basics.py | 14 | ||||
-rw-r--r-- | tests/plugins/basics/badsetup/__init__.py | 0 | ||||
-rw-r--r-- | tests/plugins/basics/badsetup/foo.py | 6 |
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/plugins/basics.py b/tests/plugins/basics.py index 561c685e8..f4b6a1699 100644 --- a/tests/plugins/basics.py +++ b/tests/plugins/basics.py @@ -132,3 +132,17 @@ 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) ]) + +# Load a factory with a plugin which provides a setup symbol that is not a function +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'badsetup')) +def test_source_bad_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 provides a setup symbol that is not a function +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'badsetup')) +def test_element_bad_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/badsetup/__init__.py b/tests/plugins/basics/badsetup/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/plugins/basics/badsetup/__init__.py diff --git a/tests/plugins/basics/badsetup/foo.py b/tests/plugins/basics/badsetup/foo.py new file mode 100644 index 000000000..145f2577b --- /dev/null +++ b/tests/plugins/basics/badsetup/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 provides a setup() symbol that is +# not even a function +setup = 5 |