summaryrefslogtreecommitdiff
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
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.
-rw-r--r--tests/format/project.py32
-rw-r--r--tests/format/project/plugin-no-load-ref/noloadref.bst (renamed from tests/pipeline/load/noloadref/noloadref.bst)0
-rw-r--r--tests/format/project/plugin-no-load-ref/plugins/noloadref.py (renamed from tests/pipeline/load/noloadref/plugins/noloadref.py)0
-rw-r--r--tests/format/project/plugin-no-load-ref/project.refs (renamed from tests/pipeline/load/noloadref/project.refs)0
-rw-r--r--tests/pipeline/load.py32
5 files changed, 32 insertions, 32 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=[
diff --git a/tests/pipeline/load/noloadref/noloadref.bst b/tests/format/project/plugin-no-load-ref/noloadref.bst
index 23a52ef8f..23a52ef8f 100644
--- a/tests/pipeline/load/noloadref/noloadref.bst
+++ b/tests/format/project/plugin-no-load-ref/noloadref.bst
diff --git a/tests/pipeline/load/noloadref/plugins/noloadref.py b/tests/format/project/plugin-no-load-ref/plugins/noloadref.py
index 0cc457f07..0cc457f07 100644
--- a/tests/pipeline/load/noloadref/plugins/noloadref.py
+++ b/tests/format/project/plugin-no-load-ref/plugins/noloadref.py
diff --git a/tests/pipeline/load/noloadref/project.refs b/tests/format/project/plugin-no-load-ref/project.refs
index b06a4577d..b06a4577d 100644
--- a/tests/pipeline/load/noloadref/project.refs
+++ b/tests/format/project/plugin-no-load-ref/project.refs
diff --git a/tests/pipeline/load.py b/tests/pipeline/load.py
index 50fa184b6..9f51d8e33 100644
--- a/tests/pipeline/load.py
+++ b/tests/pipeline/load.py
@@ -16,35 +16,3 @@ def test_load_simple(cli, datafiles):
result = cli.get_element_config(basedir, 'simple.bst')
assert(result['configure-commands'][0] == 'pony')
-
-
-@pytest.mark.datafiles(os.path.join(DATA_DIR, 'noloadref'))
-@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
-def test_unsupported_load_ref(cli, datafiles, ref_storage):
- basedir = os.path.join(datafiles.dirname, datafiles.basename)
-
- # 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(basedir, 'project.conf'))
-
- result = cli.run(project=basedir, 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')