summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2020-05-13 21:55:03 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2020-05-13 21:55:03 +0900
commit39cf9be3b7e6905e293fe24192f539744a6da27a (patch)
tree6e81c0cdeec60e67a6e11542ba729a1d8268e1cc
parente6134500df5f122d16e70dfbd6a82b891cebf601 (diff)
downloadbuildstream-39cf9be3b7e6905e293fe24192f539744a6da27a.tar.gz
tests/plugins/loading.py: Added tests for various malformed BST_MIN_VERSION
-rw-r--r--tests/plugins/loading.py7
-rw-r--r--tests/plugins/loading/plugins/elements/malformedminversion/badstring.py (renamed from tests/plugins/loading/plugins/elements/malformedminversion/malformedminversion.py)0
-rw-r--r--tests/plugins/loading/plugins/elements/malformedminversion/dict.py11
-rw-r--r--tests/plugins/loading/plugins/elements/malformedminversion/list.py11
-rw-r--r--tests/plugins/loading/plugins/elements/malformedminversion/number.py11
-rw-r--r--tests/plugins/loading/plugins/sources/malformedminversion/badstring.py (renamed from tests/plugins/loading/plugins/sources/malformedminversion/malformedminversion.py)0
-rw-r--r--tests/plugins/loading/plugins/sources/malformedminversion/dict.py11
-rw-r--r--tests/plugins/loading/plugins/sources/malformedminversion/list.py11
-rw-r--r--tests/plugins/loading/plugins/sources/malformedminversion/number.py11
9 files changed, 70 insertions, 3 deletions
diff --git a/tests/plugins/loading.py b/tests/plugins/loading.py
index 13d787b0e..bbb6c7e4d 100644
--- a/tests/plugins/loading.py
+++ b/tests/plugins/loading.py
@@ -166,7 +166,8 @@ def test_missing_min_version(cli, datafiles, plugin_type):
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("plugin_type", [("elements"), ("sources")])
-def test_malformed_min_version(cli, datafiles, plugin_type):
+@pytest.mark.parametrize("plugin", [("badstring"), ("number"), ("dict"), ("list")])
+def test_malformed_min_version(cli, datafiles, plugin_type, plugin):
project = str(datafiles)
update_project(
@@ -176,12 +177,12 @@ def test_malformed_min_version(cli, datafiles, plugin_type):
{
"origin": "local",
"path": os.path.join("plugins", plugin_type, "malformedminversion"),
- plugin_type: ["malformedminversion"],
+ plugin_type: [plugin],
}
]
},
)
- setup_element(project, plugin_type, "malformedminversion")
+ setup_element(project, plugin_type, plugin)
result = cli.run(project=project, args=["show", "element.bst"])
result.assert_main_error(ErrorDomain.PLUGIN, "malformed-min-version")
diff --git a/tests/plugins/loading/plugins/elements/malformedminversion/malformedminversion.py b/tests/plugins/loading/plugins/elements/malformedminversion/badstring.py
index 5f96c1897..5f96c1897 100644
--- a/tests/plugins/loading/plugins/elements/malformedminversion/malformedminversion.py
+++ b/tests/plugins/loading/plugins/elements/malformedminversion/badstring.py
diff --git a/tests/plugins/loading/plugins/elements/malformedminversion/dict.py b/tests/plugins/loading/plugins/elements/malformedminversion/dict.py
new file mode 100644
index 000000000..1ee2e52f4
--- /dev/null
+++ b/tests/plugins/loading/plugins/elements/malformedminversion/dict.py
@@ -0,0 +1,11 @@
+# Plugins are required to specify the BST_MIN_VERSION
+from buildstream import Element
+
+
+class MalformedMinVersion(Element):
+
+ BST_MIN_VERSION = {"major": 2, "minor": 0}
+
+
+def setup():
+ return MalformedMinVersion
diff --git a/tests/plugins/loading/plugins/elements/malformedminversion/list.py b/tests/plugins/loading/plugins/elements/malformedminversion/list.py
new file mode 100644
index 000000000..c92224969
--- /dev/null
+++ b/tests/plugins/loading/plugins/elements/malformedminversion/list.py
@@ -0,0 +1,11 @@
+# Plugins are required to specify the BST_MIN_VERSION
+from buildstream import Element
+
+
+class MalformedMinVersion(Element):
+
+ BST_MIN_VERSION = [2, 0]
+
+
+def setup():
+ return MalformedMinVersion
diff --git a/tests/plugins/loading/plugins/elements/malformedminversion/number.py b/tests/plugins/loading/plugins/elements/malformedminversion/number.py
new file mode 100644
index 000000000..154f16d33
--- /dev/null
+++ b/tests/plugins/loading/plugins/elements/malformedminversion/number.py
@@ -0,0 +1,11 @@
+# Plugins are required to specify the BST_MIN_VERSION
+from buildstream import Element
+
+
+class MalformedMinVersion(Element):
+
+ BST_MIN_VERSION = 2.0
+
+
+def setup():
+ return MalformedMinVersion
diff --git a/tests/plugins/loading/plugins/sources/malformedminversion/malformedminversion.py b/tests/plugins/loading/plugins/sources/malformedminversion/badstring.py
index 90474597c..90474597c 100644
--- a/tests/plugins/loading/plugins/sources/malformedminversion/malformedminversion.py
+++ b/tests/plugins/loading/plugins/sources/malformedminversion/badstring.py
diff --git a/tests/plugins/loading/plugins/sources/malformedminversion/dict.py b/tests/plugins/loading/plugins/sources/malformedminversion/dict.py
new file mode 100644
index 000000000..4df4d5297
--- /dev/null
+++ b/tests/plugins/loading/plugins/sources/malformedminversion/dict.py
@@ -0,0 +1,11 @@
+# Plugins are required to specify the BST_MIN_VERSION
+from buildstream import Source
+
+
+class MalformedMinVersion(Source):
+
+ BST_MIN_VERSION = {"major": 2, "minor": 0}
+
+
+def setup():
+ return MalformedMinVersion
diff --git a/tests/plugins/loading/plugins/sources/malformedminversion/list.py b/tests/plugins/loading/plugins/sources/malformedminversion/list.py
new file mode 100644
index 000000000..a3bcf1928
--- /dev/null
+++ b/tests/plugins/loading/plugins/sources/malformedminversion/list.py
@@ -0,0 +1,11 @@
+# Plugins are required to specify the BST_MIN_VERSION
+from buildstream import Source
+
+
+class MalformedMinVersion(Source):
+
+ BST_MIN_VERSION = [2, 0]
+
+
+def setup():
+ return MalformedMinVersion
diff --git a/tests/plugins/loading/plugins/sources/malformedminversion/number.py b/tests/plugins/loading/plugins/sources/malformedminversion/number.py
new file mode 100644
index 000000000..1d1517945
--- /dev/null
+++ b/tests/plugins/loading/plugins/sources/malformedminversion/number.py
@@ -0,0 +1,11 @@
+# Plugins are required to specify the BST_MIN_VERSION
+from buildstream import Source
+
+
+class MalformedMinVersion(Source):
+
+ BST_MIN_VERSION = 2.0
+
+
+def setup():
+ return MalformedMinVersion