diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-12-10 16:38:41 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-12-10 16:38:41 +0900 |
commit | fe181f44e87393eeb762613cffd90ec5a7a33435 (patch) | |
tree | b31aefa7729dd5a8f070fc5554b3731cd373810f | |
parent | 22812299a29a6ff4c7d2ee4c140ff54f26cbdba1 (diff) | |
download | buildstream-fe181f44e87393eeb762613cffd90ec5a7a33435.tar.gz |
Add variants test for illegal composition
Expect LoadError with ILLEGAL_COMPOSITE when trying to override
a value in a variant with an incorrect type.
-rw-r--r-- | tests/loader/variants.py | 13 | ||||
-rw-r--r-- | tests/loader/variants/elements/variant-illegal-composite.bst | 11 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/loader/variants.py b/tests/loader/variants.py index baa656e42..ad6d51319 100644 --- a/tests/loader/variants.py +++ b/tests/loader/variants.py @@ -62,6 +62,19 @@ def test_variant_only_one(datafiles): assert (exc.value.reason == LoadErrorReason.INVALID_DATA) +@pytest.mark.datafiles(DATA_DIR) +def test_variant_illegal_composite(datafiles): + + basedir = os.path.join(datafiles.dirname, datafiles.basename) + loader = Loader( + basedir, 'elements/variant-illegal-composite.bst', None, None) + + with pytest.raises(LoadError) as exc: + element = loader.load() + + assert (exc.value.reason == LoadErrorReason.ILLEGAL_COMPOSITE) + + ############################################################## # Test Simple Variant Compositing # ############################################################## diff --git a/tests/loader/variants/elements/variant-illegal-composite.bst b/tests/loader/variants/elements/variant-illegal-composite.bst new file mode 100644 index 000000000..d28382f1a --- /dev/null +++ b/tests/loader/variants/elements/variant-illegal-composite.bst @@ -0,0 +1,11 @@ +kind: pony +description: This variant overrides a config value with an incorrect type +config: + number: 5 +variants: +- variant: first + config: + number: four +- variant: second + config: + number: six |