From 3b1af6036c14d4a9b017776358b4ac4c5622ec9e Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Mon, 27 Apr 2020 15:35:24 +0900 Subject: tests/plugins/deprecationwarnings.py: Moved from it's subdirectory Before adding more tests to this directory, just making the directory match more the structure of other test directories. --- tests/plugins/deprecationwarnings.py | 38 ++++++++++++++++++++++ tests/plugins/deprecationwarnings/__init__.py | 0 .../deprecationwarnings/deprecationwarnings.py | 38 ---------------------- .../deprecationwarnings/elements/deprecated.bst | 1 + .../plugins/elements/deprecated_plugin.py | 11 +++++++ .../plugins/elements/deprecated_plugin.yaml | 22 +++++++++++++ tests/plugins/deprecationwarnings/project.conf | 15 +++++++++ .../project/elements/deprecated.bst | 1 - .../project/plugins/elements/deprecated_plugin.py | 11 ------- .../plugins/elements/deprecated_plugin.yaml | 22 ------------- .../deprecationwarnings/project/project.conf | 15 --------- 11 files changed, 87 insertions(+), 87 deletions(-) create mode 100644 tests/plugins/deprecationwarnings.py delete mode 100644 tests/plugins/deprecationwarnings/__init__.py delete mode 100644 tests/plugins/deprecationwarnings/deprecationwarnings.py create mode 100644 tests/plugins/deprecationwarnings/elements/deprecated.bst create mode 100644 tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py create mode 100644 tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.yaml create mode 100644 tests/plugins/deprecationwarnings/project.conf delete mode 100644 tests/plugins/deprecationwarnings/project/elements/deprecated.bst delete mode 100644 tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.py delete mode 100644 tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.yaml delete mode 100644 tests/plugins/deprecationwarnings/project/project.conf (limited to 'tests/plugins') diff --git a/tests/plugins/deprecationwarnings.py b/tests/plugins/deprecationwarnings.py new file mode 100644 index 000000000..a4da3ea72 --- /dev/null +++ b/tests/plugins/deprecationwarnings.py @@ -0,0 +1,38 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + +import os + +import pytest + +from buildstream.testing import cli # pylint: disable=unused-import + + +DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "deprecationwarnings") + +_DEPRECATION_MESSAGE = "Here is some detail." +_DEPRECATION_WARNING = "Using deprecated plugin deprecated_plugin: {}".format(_DEPRECATION_MESSAGE) + + +@pytest.mark.datafiles(DATA_DIR) +def test_deprecation_warning_present(cli, datafiles): + project = str(datafiles) + result = cli.run(project=project, args=["show", "deprecated.bst"]) + result.assert_success() + assert _DEPRECATION_WARNING in result.stderr + + +@pytest.mark.datafiles(DATA_DIR) +def test_suppress_deprecation_warning(cli, datafiles): + project = str(datafiles) + cli.run(project=project, args=["show", "manual.bst"]) + + element_overrides = "elements:\n" " deprecated_plugin:\n" " suppress-deprecation-warnings : True\n" + + project_conf = os.path.join(project, "project.conf") + with open(project_conf, "a") as f: + f.write(element_overrides) + + result = cli.run(project=project, args=["show", "deprecated.bst"]) + result.assert_success() + assert _DEPRECATION_WARNING not in result.stderr diff --git a/tests/plugins/deprecationwarnings/__init__.py b/tests/plugins/deprecationwarnings/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/plugins/deprecationwarnings/deprecationwarnings.py b/tests/plugins/deprecationwarnings/deprecationwarnings.py deleted file mode 100644 index 628faea68..000000000 --- a/tests/plugins/deprecationwarnings/deprecationwarnings.py +++ /dev/null @@ -1,38 +0,0 @@ -# Pylint doesn't play well with fixtures and dependency injection from pytest -# pylint: disable=redefined-outer-name - -import os - -import pytest - -from buildstream.testing import cli # pylint: disable=unused-import - - -DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project") - -_DEPRECATION_MESSAGE = "Here is some detail." -_DEPRECATION_WARNING = "Using deprecated plugin deprecated_plugin: {}".format(_DEPRECATION_MESSAGE) - - -@pytest.mark.datafiles(DATA_DIR) -def test_deprecation_warning_present(cli, datafiles): - project = str(datafiles) - result = cli.run(project=project, args=["show", "deprecated.bst"]) - result.assert_success() - assert _DEPRECATION_WARNING in result.stderr - - -@pytest.mark.datafiles(DATA_DIR) -def test_suppress_deprecation_warning(cli, datafiles): - project = str(datafiles) - cli.run(project=project, args=["show", "manual.bst"]) - - element_overrides = "elements:\n" " deprecated_plugin:\n" " suppress-deprecation-warnings : True\n" - - project_conf = os.path.join(project, "project.conf") - with open(project_conf, "a") as f: - f.write(element_overrides) - - result = cli.run(project=project, args=["show", "deprecated.bst"]) - result.assert_success() - assert _DEPRECATION_WARNING not in result.stderr diff --git a/tests/plugins/deprecationwarnings/elements/deprecated.bst b/tests/plugins/deprecationwarnings/elements/deprecated.bst new file mode 100644 index 000000000..e80bd91cd --- /dev/null +++ b/tests/plugins/deprecationwarnings/elements/deprecated.bst @@ -0,0 +1 @@ +kind: deprecated_plugin \ No newline at end of file diff --git a/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py b/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py new file mode 100644 index 000000000..1badf59af --- /dev/null +++ b/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py @@ -0,0 +1,11 @@ +from buildstream import BuildElement + + +class DeprecatedPlugin(BuildElement): + BST_PLUGIN_DEPRECATED = True + BST_PLUGIN_DEPRECATION_MESSAGE = "Here is some detail." + + +# Plugin entry point +def setup(): + return DeprecatedPlugin diff --git a/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.yaml b/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.yaml new file mode 100644 index 000000000..1c07cd8b2 --- /dev/null +++ b/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.yaml @@ -0,0 +1,22 @@ +# Deprecated-plugin build element does not provide any default +# build commands +config: + + # Commands for configuring the software + # + configure-commands: [] + + # Commands for building the software + # + build-commands: [] + + # Commands for installing the software into a + # destination folder + # + install-commands: [] + + # Commands for stripping installed binaries + # + strip-commands: + - | + %{strip-binaries} \ No newline at end of file diff --git a/tests/plugins/deprecationwarnings/project.conf b/tests/plugins/deprecationwarnings/project.conf new file mode 100644 index 000000000..9e03afe0a --- /dev/null +++ b/tests/plugins/deprecationwarnings/project.conf @@ -0,0 +1,15 @@ +# Unique project name +name: deprecation-warnings + +# Required BuildStream version +min-version: 2.0 + +# Subdirectory where elements are stored +element-path: elements + +plugins: + +- origin: local + path: plugins/elements + elements: + - deprecated_plugin diff --git a/tests/plugins/deprecationwarnings/project/elements/deprecated.bst b/tests/plugins/deprecationwarnings/project/elements/deprecated.bst deleted file mode 100644 index e80bd91cd..000000000 --- a/tests/plugins/deprecationwarnings/project/elements/deprecated.bst +++ /dev/null @@ -1 +0,0 @@ -kind: deprecated_plugin \ No newline at end of file diff --git a/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.py b/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.py deleted file mode 100644 index 1badf59af..000000000 --- a/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.py +++ /dev/null @@ -1,11 +0,0 @@ -from buildstream import BuildElement - - -class DeprecatedPlugin(BuildElement): - BST_PLUGIN_DEPRECATED = True - BST_PLUGIN_DEPRECATION_MESSAGE = "Here is some detail." - - -# Plugin entry point -def setup(): - return DeprecatedPlugin diff --git a/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.yaml b/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.yaml deleted file mode 100644 index 1c07cd8b2..000000000 --- a/tests/plugins/deprecationwarnings/project/plugins/elements/deprecated_plugin.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# Deprecated-plugin build element does not provide any default -# build commands -config: - - # Commands for configuring the software - # - configure-commands: [] - - # Commands for building the software - # - build-commands: [] - - # Commands for installing the software into a - # destination folder - # - install-commands: [] - - # Commands for stripping installed binaries - # - strip-commands: - - | - %{strip-binaries} \ No newline at end of file diff --git a/tests/plugins/deprecationwarnings/project/project.conf b/tests/plugins/deprecationwarnings/project/project.conf deleted file mode 100644 index 9e03afe0a..000000000 --- a/tests/plugins/deprecationwarnings/project/project.conf +++ /dev/null @@ -1,15 +0,0 @@ -# Unique project name -name: deprecation-warnings - -# Required BuildStream version -min-version: 2.0 - -# Subdirectory where elements are stored -element-path: elements - -plugins: - -- origin: local - path: plugins/elements - elements: - - deprecated_plugin -- cgit v1.2.1