diff options
8 files changed, 93 insertions, 1 deletions
@@ -9,7 +9,7 @@ parentdir_prefix = BuildStream- [tool:pytest] addopts = --verbose --basetemp ./tmp --durations=20 --timeout=1800 -norecursedirs = src tests/integration/project tests/plugins/loading integration-cache tmp __pycache__ .eggs +norecursedirs = src tests/integration/project tests/plugins/loading tests/plugins/sample-plugins integration-cache tmp __pycache__ .eggs python_files = tests/*/*.py env = D:BST_TEST_SUITE=True diff --git a/tests/plugins/sample-plugins/setup.py b/tests/plugins/sample-plugins/setup.py new file mode 100755 index 000000000..8429c7cd7 --- /dev/null +++ b/tests/plugins/sample-plugins/setup.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2020 Codethink Limited +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library. If not, see <http://www.gnu.org/licenses/>. +# + +from setuptools import setup, find_packages + +setup( + name="sample-plugins", + version="1.2.3", + description="A collection of sample plugins for testing.", + license="LGPL", + url="https://example.com/sample-plugins", + package_dir={"": "src"}, + packages=find_packages(where="src"), + include_package_data=True, + entry_points={ + "buildstream.plugins.elements": ["sample = sample_plugins.elements.sample",], + "buildstream.plugins.sources": ["sample = sample_plugins.sources.sample",], + }, + zip_safe=False, +) +# eof setup() diff --git a/tests/plugins/sample-plugins/src/sample_plugins/__init__.py b/tests/plugins/sample-plugins/src/sample_plugins/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/__init__.py diff --git a/tests/plugins/sample-plugins/src/sample_plugins/elements/__init__.py b/tests/plugins/sample-plugins/src/sample_plugins/elements/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/elements/__init__.py diff --git a/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.py b/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.py new file mode 100644 index 000000000..590e99ee8 --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.py @@ -0,0 +1,19 @@ +from buildstream import Element + + +class Sample(Element): + BST_MIN_VERSION = "2.0" + + def configure(self, node): + pass + + def preflight(self): + pass + + def get_unique_key(self): + return {} + + +# Plugin entry point +def setup(): + return Sample diff --git a/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.yaml b/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.yaml new file mode 100644 index 000000000..956ad14d4 --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/elements/sample.yaml @@ -0,0 +1,5 @@ +# Set a variable so that we can test that the yaml +# was actually loaded using bst show. +# +variables: + sample-loaded: True diff --git a/tests/plugins/sample-plugins/src/sample_plugins/sources/__init__.py b/tests/plugins/sample-plugins/src/sample_plugins/sources/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/sources/__init__.py diff --git a/tests/plugins/sample-plugins/src/sample_plugins/sources/sample.py b/tests/plugins/sample-plugins/src/sample_plugins/sources/sample.py new file mode 100644 index 000000000..968a0e342 --- /dev/null +++ b/tests/plugins/sample-plugins/src/sample_plugins/sources/sample.py @@ -0,0 +1,32 @@ +from buildstream import Source + + +class Sample(Source): + BST_MIN_VERSION = "2.0" + + def configure(self, node): + pass + + def preflight(self): + pass + + def get_unique_key(self): + return {} + + def load_ref(self, node): + pass + + def get_ref(self): + return {} + + def set_ref(self, ref, node): + pass + + def is_cached(self): + return False + + +# Plugin entry point +def setup(): + + return Sample |