From 50b694a3a5abaa134d30add8b75b62f7e833a648 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Fri, 6 Apr 2018 16:50:02 +0900 Subject: tests/project/plugins.py: Removed this old style test This is sufficiently covered by other tests in tests/format/project.py --- tests/project/__init__.py | 0 tests/project/data/plugins/custom.bst | 9 ----- tests/project/data/plugins/elements/__init__.py | 0 tests/project/data/plugins/elements/custom.py | 19 ---------- tests/project/data/plugins/project.conf | 13 ------- tests/project/data/plugins/sources/__init__.py | 0 tests/project/data/plugins/sources/custom.py | 31 ---------------- tests/project/plugins.py | 47 ------------------------- 8 files changed, 119 deletions(-) delete mode 100644 tests/project/__init__.py delete mode 100644 tests/project/data/plugins/custom.bst delete mode 100644 tests/project/data/plugins/elements/__init__.py delete mode 100644 tests/project/data/plugins/elements/custom.py delete mode 100644 tests/project/data/plugins/project.conf delete mode 100644 tests/project/data/plugins/sources/__init__.py delete mode 100644 tests/project/data/plugins/sources/custom.py delete mode 100644 tests/project/plugins.py diff --git a/tests/project/__init__.py b/tests/project/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/project/data/plugins/custom.bst b/tests/project/data/plugins/custom.bst deleted file mode 100644 index 6a378347a..000000000 --- a/tests/project/data/plugins/custom.bst +++ /dev/null @@ -1,9 +0,0 @@ -kind: custom -description: Some kinda custom element - -sources: -- kind: custom - configuration: pony - -config: - configuration: pony diff --git a/tests/project/data/plugins/elements/__init__.py b/tests/project/data/plugins/elements/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/project/data/plugins/elements/custom.py b/tests/project/data/plugins/elements/custom.py deleted file mode 100644 index c18c234a9..000000000 --- a/tests/project/data/plugins/elements/custom.py +++ /dev/null @@ -1,19 +0,0 @@ -from buildstream import Element - - -class CustomElement(Element): - - def configure(self, node): - print("Element Data: {}".format(node)) - self.node_validate(node, ['configuration']) - self.configuration = self.node_subst_member(node, "configuration", '') - - def preflight(self): - pass - - def get_unique_key(self): - return self.configuration - - -def setup(): - return CustomElement diff --git a/tests/project/data/plugins/project.conf b/tests/project/data/plugins/project.conf deleted file mode 100644 index 7d4cbd1ee..000000000 --- a/tests/project/data/plugins/project.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Basic project configuration that provides some plugins -# -name: pony - -plugins: -- origin: local - path: elements - elements: - custom: 0 -- origin: local - path: sources - sources: - custom: 0 diff --git a/tests/project/data/plugins/sources/__init__.py b/tests/project/data/plugins/sources/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/project/data/plugins/sources/custom.py b/tests/project/data/plugins/sources/custom.py deleted file mode 100644 index 54c372bac..000000000 --- a/tests/project/data/plugins/sources/custom.py +++ /dev/null @@ -1,31 +0,0 @@ -from buildstream import Source, Consistency - - -class CustomSource(Source): - - def configure(self, node): - print("Source Data: {}".format(node)) - self.node_validate(node, ['configuration'] + Source.COMMON_CONFIG_KEYS) - self.configuration = self.node_get_member(node, str, "configuration") - - def preflight(self): - pass - - def get_unique_key(self): - return self.configuration - - def get_consistency(self): - return Consistency.INCONSISTENT - - def refresh(self, node): - return False - - def fetch(self): - pass - - def stage(self, directory): - pass - - -def setup(): - return CustomSource diff --git a/tests/project/plugins.py b/tests/project/plugins.py deleted file mode 100644 index 432983dc5..000000000 --- a/tests/project/plugins.py +++ /dev/null @@ -1,47 +0,0 @@ -import os -import pytest - -from buildstream._context import Context -from buildstream._project import Project -from buildstream._pipeline import Pipeline - -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - 'data', -) - - -def create_pipeline(tmpdir, basedir, target): - context = Context() - project = Project(basedir, context) - context.artifactdir = os.path.join(str(tmpdir), 'artifact') - - def dummy_handler(message, context): - pass - - context.set_message_handler(dummy_handler) - - return Pipeline(context, project, [target], []) - - -# We've already validated that the plugin system works in -# other tests, here we just want to load a custom plugin -# and see if some of our configuration ended up on it, and -# also test that the project's configuration of plugin -# paths is actually working. -# -@pytest.mark.datafiles(os.path.join(DATA_DIR, 'plugins')) -def test_custom_element(datafiles, tmpdir): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - pipeline = create_pipeline(tmpdir, basedir, 'custom.bst') - - element = pipeline.targets[0] - assert(len(element._Element__sources) > 0) - source = element._Element__sources[0] - - assert(element.get_kind() == "custom") - assert(source.get_kind() == "custom") - - assert(element.configuration == "pony") - assert(source.configuration == "pony") -- cgit v1.2.1