summaryrefslogtreecommitdiff
path: root/tests/plugins
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-08-29 22:25:30 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-08-29 22:32:15 -0400
commit68493ad74f0d060e12ae6240a6dd60db6947f98f (patch)
tree3cfd72f555b8e7e64772673c8e7a55615d944cff /tests/plugins
parentbadbda8e81ee0584d81eecbf111e3a3ae3d76967 (diff)
downloadbuildstream-68493ad74f0d060e12ae6240a6dd60db6947f98f.tar.gz
plugins tests: Fixed to expect errors at plugin load time
Errors which were previously detected when loading the plugin context are now only detected when loading the plugin.
Diffstat (limited to 'tests/plugins')
-rw-r--r--tests/plugins/basics.py56
1 files changed, 32 insertions, 24 deletions
diff --git a/tests/plugins/basics.py b/tests/plugins/basics.py
index 06b028403..b1506b64f 100644
--- a/tests/plugins/basics.py
+++ b/tests/plugins/basics.py
@@ -115,77 +115,85 @@ def test_conflict_element(plugin_fixture, datafiles):
# Load a factory with a plugin that returns a value instead of Source subclass
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'notatype'))
def test_source_notatype(plugin_fixture, datafiles):
+ factory = SourceFactory(plugin_fixture['base'],
+ [os.path.join(datafiles.dirname,
+ datafiles.basename)])
with pytest.raises(PluginError) as exc:
- factory = SourceFactory(plugin_fixture['base'],
- [os.path.join(datafiles.dirname,
- datafiles.basename)])
+ foo_type = factory.lookup('foo')
# Load a factory with a plugin that returns a value instead of Element subclass
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'notatype'))
def test_element_notatype(plugin_fixture, datafiles):
+ factory = ElementFactory(plugin_fixture['base'],
+ [os.path.join(datafiles.dirname,
+ datafiles.basename)])
with pytest.raises(PluginError) as exc:
- factory = ElementFactory(plugin_fixture['base'],
- [os.path.join(datafiles.dirname,
- datafiles.basename)])
+ foo_type = factory.lookup('foo')
# Load a factory with a plugin that returns a type
# which is not a Source subclass
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'wrongtype'))
def test_source_wrongtype(plugin_fixture, datafiles):
+ factory = SourceFactory(plugin_fixture['base'],
+ [os.path.join(datafiles.dirname,
+ datafiles.basename)])
with pytest.raises(PluginError) as exc:
- factory = SourceFactory(plugin_fixture['base'],
- [os.path.join(datafiles.dirname,
- datafiles.basename)])
+ foo_type = factory.lookup('foo')
# Load a factory with a plugin that returns a type
# which is not a Element subclass
@pytest.mark.datafiles(os.path.join(DATA_DIR, 'wrongtype'))
def test_element_wrongtype(plugin_fixture, datafiles):
+ factory = ElementFactory(plugin_fixture['base'],
+ [os.path.join(datafiles.dirname,
+ datafiles.basename)])
with pytest.raises(PluginError) as exc:
- factory = ElementFactory(plugin_fixture['base'],
- [os.path.join(datafiles.dirname,
- datafiles.basename)])
+ foo_type = factory.lookup('foo')
# 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):
+ factory = SourceFactory(plugin_fixture['base'],
+ [os.path.join(datafiles.dirname,
+ datafiles.basename)])
with pytest.raises(PluginError) as exc:
- factory = SourceFactory(plugin_fixture['base'],
- [os.path.join(datafiles.dirname,
- datafiles.basename)])
+ foo_type = factory.lookup('foo')
# 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):
+ factory = ElementFactory(plugin_fixture['base'],
+ [os.path.join(datafiles.dirname,
+ datafiles.basename)])
with pytest.raises(PluginError) as exc:
- factory = ElementFactory(plugin_fixture['base'],
- [os.path.join(datafiles.dirname,
- datafiles.basename)])
+ foo_type = factory.lookup('foo')
# 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):
+ factory = SourceFactory(plugin_fixture['base'],
+ [os.path.join(datafiles.dirname,
+ datafiles.basename)])
with pytest.raises(PluginError) as exc:
- factory = SourceFactory(plugin_fixture['base'],
- [os.path.join(datafiles.dirname,
- datafiles.basename)])
+ foo_type = factory.lookup('foo')
# 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):
+ factory = ElementFactory(plugin_fixture['base'],
+ [os.path.join(datafiles.dirname,
+ datafiles.basename)])
with pytest.raises(PluginError) as exc:
- factory = ElementFactory(plugin_fixture['base'],
- [os.path.join(datafiles.dirname,
- datafiles.basename)])
+ foo_type = factory.lookup('foo')
##############################################################