summaryrefslogtreecommitdiff
path: root/tests/format/project.py
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-11 14:02:14 -0500
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-01-16 18:35:21 -0500
commit8f2b4e9aa0631b8622804206d5742701fd3e03c0 (patch)
tree5c08993921d54369b0551c6d5057aaa3a5fa4b0d /tests/format/project.py
parentbbde1c2139618858706f6d9606786943ac8c9a62 (diff)
downloadbuildstream-8f2b4e9aa0631b8622804206d5742701fd3e03c0.tar.gz
tests: Migrate test for load_ref() unsupporting plugins into format/project.py
The tests/format/project.py test already has some tests about how we error gracefully for bad plugins and bad plugin configurations, lets put it there rather than tests/pipeline/load.py which we will remove.
Diffstat (limited to 'tests/format/project.py')
-rw-r--r--tests/format/project.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/format/project.py b/tests/format/project.py
index 02e8afb37..294b9a4ff 100644
--- a/tests/format/project.py
+++ b/tests/format/project.py
@@ -156,6 +156,38 @@ def test_project_plugin_load_forbidden(cli, datafiles):
@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
+def test_project_plugin_no_load_ref(cli, datafiles, ref_storage):
+ project = os.path.join(datafiles.dirname, datafiles.basename, 'plugin-no-load-ref')
+
+ # Generate project with access to the noloadref plugin and project.refs enabled
+ #
+ config = {
+ 'name': 'test',
+ 'ref-storage': ref_storage,
+ 'plugins': [
+ {
+ 'origin': 'local',
+ 'path': 'plugins',
+ 'sources': {
+ 'noloadref': 0
+ }
+ }
+ ]
+ }
+ _yaml.dump(config, os.path.join(project, 'project.conf'))
+
+ result = cli.run(project=project, silent=True, args=['show', 'noloadref.bst'])
+
+ # There is no error if project.refs is not in use, otherwise we
+ # assert our graceful failure
+ if ref_storage == 'inline':
+ result.assert_success()
+ else:
+ result.assert_main_error(ErrorDomain.SOURCE, 'unsupported-load-ref')
+
+
+@pytest.mark.datafiles(DATA_DIR)
def test_project_conf_duplicate_plugins(cli, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename, 'duplicate-plugins')
result = cli.run(project=project, silent=True, args=[