diff options
author | bst-marge-bot <marge-bot@buildstream.build> | 2019-06-06 11:33:45 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-06-06 11:33:45 +0000 |
commit | e0bd68cabf4d2b182dee27e7c5db86d610bdc924 (patch) | |
tree | acf494d6830289a5ad2150047f69c60ed34b1742 | |
parent | 2e755c87427a4896b4e959d7e5741b85558d6274 (diff) | |
parent | ce539abcc4962eb78aa5419b7cefd8554541c80e (diff) | |
download | buildstream-e0bd68cabf4d2b182dee27e7c5db86d610bdc924.tar.gz |
Merge branch 'bschubert/pylint-integration' into 'master'
Ensure pylint runs in tests/integration
See merge request BuildStream/buildstream!1376
24 files changed, 116 insertions, 46 deletions
diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/integration/__init__.py diff --git a/tests/integration/artifact.py b/tests/integration/artifact.py index b942c1690..27bf1a857 100644 --- a/tests/integration/artifact.py +++ b/tests/integration/artifact.py @@ -18,17 +18,17 @@ # Authors: Richard Maw <richard.maw@codethink.co.uk> # -from contextlib import contextmanager +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os -import pytest import shutil -import tempfile -from buildstream import utils -from buildstream.testing import cli_integration as cli +import pytest + +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils import create_artifact_share from tests.testutils.site import HAVE_SANDBOX -from buildstream._cas import CASCache pytestmark = pytest.mark.integration diff --git a/tests/integration/autotools.py b/tests/integration/autotools.py index 80365b8ee..9b462013b 100644 --- a/tests/integration/autotools.py +++ b/tests/integration/autotools.py @@ -1,7 +1,10 @@ +# 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_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from buildstream.testing.integration import assert_contains from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/build-uid.py b/tests/integration/build-uid.py index f2e50a3c7..d11153d55 100644 --- a/tests/integration/build-uid.py +++ b/tests/integration/build-uid.py @@ -1,7 +1,10 @@ +# 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_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_BWRAP, IS_LINUX, HAVE_SANDBOX diff --git a/tests/integration/cachedfail.py b/tests/integration/cachedfail.py index 489e48379..96cfdb723 100644 --- a/tests/integration/cachedfail.py +++ b/tests/integration/cachedfail.py @@ -1,9 +1,12 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml from buildstream._exceptions import ErrorDomain -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.conftest import clean_platform_cache from tests.testutils import create_artifact_share diff --git a/tests/integration/cmake.py b/tests/integration/cmake.py index a69b9cd80..87b850e2d 100644 --- a/tests/integration/cmake.py +++ b/tests/integration/cmake.py @@ -1,7 +1,10 @@ +# 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_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from buildstream.testing.integration import assert_contains from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/compose-symlinks.py b/tests/integration/compose-symlinks.py index e510d9573..061d8f8e4 100644 --- a/tests/integration/compose-symlinks.py +++ b/tests/integration/compose-symlinks.py @@ -1,7 +1,10 @@ +# 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_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import pytestmark = pytest.mark.integration diff --git a/tests/integration/compose.py b/tests/integration/compose.py index dab05fd9f..23b90a2df 100644 --- a/tests/integration/compose.py +++ b/tests/integration/compose.py @@ -1,9 +1,12 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from buildstream.testing.integration import walk_dir from tests.testutils.site import HAVE_SANDBOX @@ -17,7 +20,10 @@ DATA_DIR = os.path.join( ) -def create_compose_element(name, path, config={}): +def create_compose_element(name, path, config=None): + if config is None: + config = {} + element = { 'kind': 'compose', 'depends': [{ diff --git a/tests/integration/import.py b/tests/integration/import.py index 26c8cf6a0..5371ec61a 100644 --- a/tests/integration/import.py +++ b/tests/integration/import.py @@ -1,9 +1,12 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from buildstream.testing.integration import walk_dir diff --git a/tests/integration/make.py b/tests/integration/make.py index f59c2b0d6..78a2c8f91 100644 --- a/tests/integration/make.py +++ b/tests/integration/make.py @@ -1,7 +1,10 @@ +# 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_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from buildstream.testing.integration import assert_contains from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/manual.py b/tests/integration/manual.py index 0ba650bde..1d193b587 100644 --- a/tests/integration/manual.py +++ b/tests/integration/manual.py @@ -1,9 +1,12 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/messages.py b/tests/integration/messages.py index 2211ea468..51385de5d 100644 --- a/tests/integration/messages.py +++ b/tests/integration/messages.py @@ -17,12 +17,15 @@ # Authors: Tristan Maat <tristan.maat@codethink.co.uk> # +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml from buildstream._exceptions import ErrorDomain -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/pip_element.py b/tests/integration/pip_element.py index 94130d9ab..834ce4c63 100644 --- a/tests/integration/pip_element.py +++ b/tests/integration/pip_element.py @@ -1,12 +1,15 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from buildstream.testing.integration import assert_contains -from tests.testutils import setup_pypi_repo +from tests.testutils import setup_pypi_repo # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/pip_source.py b/tests/integration/pip_source.py index 3ba3a50b4..91fcbc6a8 100644 --- a/tests/integration/pip_source.py +++ b/tests/integration/pip_source.py @@ -1,11 +1,14 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from buildstream.testing.integration import assert_contains -from tests.testutils.python_repo import setup_pypi_repo +from tests.testutils.python_repo import setup_pypi_repo # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/pullbuildtrees.py b/tests/integration/pullbuildtrees.py index f37023e49..c562149df 100644 --- a/tests/integration/pullbuildtrees.py +++ b/tests/integration/pullbuildtrees.py @@ -1,17 +1,17 @@ -from contextlib import contextmanager +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os -import pytest import shutil -import tempfile -from tests.testutils import create_artifact_share -from tests.testutils.site import HAVE_SANDBOX +import pytest -from buildstream import utils -from buildstream.testing import cli, cli_integration as cli2 -from buildstream._cas import CASCache +from buildstream.testing import cli, cli_integration as cli2 # pylint: disable=unused-import from buildstream._exceptions import ErrorDomain, LoadErrorReason +from tests.testutils import create_artifact_share +from tests.testutils.site import HAVE_SANDBOX + DATA_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), diff --git a/tests/integration/sandbox-bwrap.py b/tests/integration/sandbox-bwrap.py index 549de4ed0..e1c676ea5 100644 --- a/tests/integration/sandbox-bwrap.py +++ b/tests/integration/sandbox-bwrap.py @@ -1,9 +1,12 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream._exceptions import ErrorDomain -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_BWRAP, HAVE_BWRAP_JSON_STATUS diff --git a/tests/integration/script.py b/tests/integration/script.py index acc752f48..cb95aae36 100644 --- a/tests/integration/script.py +++ b/tests/integration/script.py @@ -1,8 +1,11 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX @@ -15,7 +18,13 @@ DATA_DIR = os.path.join( ) -def create_script_element(name, path, config={}, variables={}): +def create_script_element(name, path, config=None, variables=None): + if config is None: + config = {} + + if variables is None: + variables = {} + element = { 'kind': 'script', 'depends': [{ diff --git a/tests/integration/shell.py b/tests/integration/shell.py index a9fb4855a..4f08504c9 100644 --- a/tests/integration/shell.py +++ b/tests/integration/shell.py @@ -1,8 +1,11 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX @@ -239,10 +242,7 @@ def test_host_files_missing(cli, datafiles, optional): project = str(datafiles) ponyfile = os.path.join(project, 'files', 'shell-mount', 'horsy.txt') - if optional == "optional": - option = True - else: - option = False + option = (optional == "optional") # Assert that we did successfully run something in the shell anyway result = execute_shell(cli, project, ['echo', 'Hello'], config={ diff --git a/tests/integration/shellbuildtrees.py b/tests/integration/shellbuildtrees.py index aa41eba36..e371884e4 100644 --- a/tests/integration/shellbuildtrees.py +++ b/tests/integration/shellbuildtrees.py @@ -1,11 +1,16 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os -import pytest import shutil +import pytest + +from buildstream.testing import cli, cli_integration # pylint: disable=unused-import +from buildstream._exceptions import ErrorDomain + from tests.testutils import create_artifact_share from tests.testutils.site import HAVE_SANDBOX -from buildstream.testing import cli, cli_integration -from buildstream._exceptions import ErrorDomain pytestmark = pytest.mark.integration diff --git a/tests/integration/sockets.py b/tests/integration/sockets.py index af09c391b..f9ad45bd0 100644 --- a/tests/integration/sockets.py +++ b/tests/integration/sockets.py @@ -1,7 +1,10 @@ +# 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_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py index 5bb0941d1..de5b36e6f 100644 --- a/tests/integration/source-determinism.py +++ b/tests/integration/source-determinism.py @@ -1,9 +1,11 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli -from buildstream.testing import create_repo +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/stack.py b/tests/integration/stack.py index 9cc917e0e..9248f5b27 100644 --- a/tests/integration/stack.py +++ b/tests/integration/stack.py @@ -1,7 +1,10 @@ +# 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_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/symlinks.py b/tests/integration/symlinks.py index 02238aebc..9c58fa40b 100644 --- a/tests/integration/symlinks.py +++ b/tests/integration/symlinks.py @@ -1,7 +1,10 @@ +# 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_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX diff --git a/tests/integration/workspace.py b/tests/integration/workspace.py index 134ed6385..e44e26def 100644 --- a/tests/integration/workspace.py +++ b/tests/integration/workspace.py @@ -1,8 +1,11 @@ +# Pylint doesn't play well with fixtures and dependency injection from pytest +# pylint: disable=redefined-outer-name + import os import pytest from buildstream import _yaml -from buildstream.testing import cli_integration as cli +from buildstream.testing import cli_integration as cli # pylint: disable=unused-import from tests.testutils.site import HAVE_SANDBOX |