diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-08-30 22:17:16 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-08-30 22:59:17 -0400 |
commit | 4005ff5f7a2aedc0d39425278fb337b4aa6a85d6 (patch) | |
tree | fad116f392a3a17bc576c1b18c56dd390ecf96ed /tests/plugins/pipeline.py | |
parent | 347983ca1641bd9fa121863008d290992a70d210 (diff) | |
download | buildstream-format-version.tar.gz |
plugin tests: Adding new tests with plugins loaded in a pipelineformat-version
o Testing that we can load a custom element or source
o Testing that we assert and trigger an error when the requested
format version of a plugin by the project is greater than the
reported version of the plugin
Diffstat (limited to 'tests/plugins/pipeline.py')
-rw-r--r-- | tests/plugins/pipeline.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/plugins/pipeline.py b/tests/plugins/pipeline.py new file mode 100644 index 000000000..868145a11 --- /dev/null +++ b/tests/plugins/pipeline.py @@ -0,0 +1,52 @@ +import os +import pytest + +from buildstream import Context, Project, Scope, PluginError +from buildstream._pipeline import Pipeline + +DATA_DIR = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + 'pipeline', +) + + +def create_pipeline(tmpdir, basedir, target, variant): + context = Context('x86_64') + project = Project(basedir, 'x86_64') + + context.deploydir = os.path.join(str(tmpdir), 'deploy') + context.artifactdir = os.path.join(str(tmpdir), 'artifact') + + return Pipeline(context, project, target, variant) + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'customsource')) +def test_customsource(datafiles, tmpdir): + + basedir = os.path.join(datafiles.dirname, datafiles.basename) + pipeline = create_pipeline(tmpdir, basedir, 'simple.bst', None) + assert(pipeline.target.get_kind() == "autotools") + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'customelement')) +def test_customelement(datafiles, tmpdir): + + basedir = os.path.join(datafiles.dirname, datafiles.basename) + pipeline = create_pipeline(tmpdir, basedir, 'simple.bst', None) + assert(pipeline.target.get_kind() == "foo") + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'badversionsource')) +def test_badversionsource(datafiles, tmpdir): + basedir = os.path.join(datafiles.dirname, datafiles.basename) + + with pytest.raises(PluginError) as exc: + pipeline = create_pipeline(tmpdir, basedir, 'simple.bst', None) + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'badversionelement')) +def test_badversionelement(datafiles, tmpdir): + basedir = os.path.join(datafiles.dirname, datafiles.basename) + + with pytest.raises(PluginError) as exc: + pipeline = create_pipeline(tmpdir, basedir, 'simple.bst', None) |