summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbst-marge-bot <marge-bot@buildstream.build>2019-06-06 15:52:40 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-06-06 15:52:40 +0000
commit1e3ef2d7a9885a5514cf66d12df5890a3c6e04b0 (patch)
treee21eada1ed1d788bae56644c75a1acea8ab625c2
parentff0555ab712d13ec3a7b8388684fdd2ea4e82926 (diff)
parentb7f870e31954409f6d598a0650af26fa52c317b8 (diff)
downloadbuildstream-1e3ef2d7a9885a5514cf66d12df5890a3c6e04b0.tar.gz
Merge branch 'bschubert/pylint-artifactcache' into 'master'
Ensure pylint runs in tests/artifactcache See merge request BuildStream/buildstream!1377
-rw-r--r--tests/artifactcache/__init__.py0
-rw-r--r--tests/artifactcache/artifactservice.py4
-rw-r--r--tests/artifactcache/cache_size.py5
-rw-r--r--tests/artifactcache/config.py17
-rw-r--r--tests/artifactcache/expiry.py5
-rw-r--r--tests/artifactcache/junctions.py5
-rw-r--r--tests/artifactcache/pull.py6
-rw-r--r--tests/artifactcache/push.py6
8 files changed, 34 insertions, 14 deletions
diff --git a/tests/artifactcache/__init__.py b/tests/artifactcache/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/artifactcache/__init__.py
diff --git a/tests/artifactcache/artifactservice.py b/tests/artifactcache/artifactservice.py
index 791083b17..ac9514793 100644
--- a/tests/artifactcache/artifactservice.py
+++ b/tests/artifactcache/artifactservice.py
@@ -17,20 +17,18 @@
# Authors: Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>
#
import os
-import pytest
import signal
from urllib.parse import urlparse
from multiprocessing import Process, Queue
import grpc
+import pytest
from buildstream._protos.buildstream.v2.artifact_pb2 \
import Artifact, GetArtifactRequest, UpdateArtifactRequest
from buildstream._protos.buildstream.v2.artifact_pb2_grpc import ArtifactServiceStub
from buildstream._protos.build.bazel.remote.execution.v2 \
import remote_execution_pb2 as re_pb2
-from buildstream._protos.build.bazel.remote.execution.v2 \
- import remote_execution_pb2_grpc as re_pb2_grpc
from buildstream import utils
from buildstream import _signals
diff --git a/tests/artifactcache/cache_size.py b/tests/artifactcache/cache_size.py
index 09f0f25d0..3a2956c5c 100644
--- a/tests/artifactcache/cache_size.py
+++ b/tests/artifactcache/cache_size.py
@@ -1,10 +1,13 @@
+# Pylint doesn't play well with fixtures and dependency injection from pytest
+# pylint: disable=redefined-outer-name
+
import os
from unittest import mock
from buildstream import _yaml
from buildstream._cas.cascache import CACHE_SIZE_FILE
from buildstream._exceptions import ErrorDomain
-from buildstream.testing import cli
+from buildstream.testing import cli # pylint: disable=unused-import
from tests.testutils import create_element_size
diff --git a/tests/artifactcache/config.py b/tests/artifactcache/config.py
index 8adbb3274..591cc0e03 100644
--- a/tests/artifactcache/config.py
+++ b/tests/artifactcache/config.py
@@ -1,8 +1,11 @@
-import pytest
+# Pylint doesn't play well with fixtures and dependency injection from pytest
+# pylint: disable=redefined-outer-name
import itertools
import os
+import pytest
+
from buildstream._artifactcache import ArtifactCacheSpec, ArtifactCache
from buildstream._context import Context
from buildstream._project import Project
@@ -10,7 +13,7 @@ from buildstream.utils import _deduplicate
from buildstream import _yaml
from buildstream._exceptions import ErrorDomain, LoadErrorReason
-from buildstream.testing.runcli import cli
+from buildstream.testing.runcli import cli # pylint: disable=unused-import
DATA_DIR = os.path.dirname(os.path.realpath(__file__))
@@ -24,7 +27,13 @@ cache6 = ArtifactCacheSpec(url='https://example.com/cache6', push=True)
# Generate cache configuration fragments for the user config and project config files.
#
-def configure_remote_caches(override_caches, project_caches=[], user_caches=[]):
+def configure_remote_caches(override_caches, project_caches=None, user_caches=None):
+ if project_caches is None:
+ project_caches = []
+
+ if user_caches is None:
+ user_caches = []
+
user_config = {}
if len(user_caches) == 1:
user_config['artifacts'] = {
@@ -55,7 +64,7 @@ def configure_remote_caches(override_caches, project_caches=[], user_caches=[]):
}
project_config = {}
- if len(project_caches) > 0:
+ if project_caches:
if len(project_caches) == 1:
project_config.update({
'artifacts': {
diff --git a/tests/artifactcache/expiry.py b/tests/artifactcache/expiry.py
index 6aa518f1a..b163903cb 100644
--- a/tests/artifactcache/expiry.py
+++ b/tests/artifactcache/expiry.py
@@ -17,6 +17,9 @@
# 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 re
from unittest import mock
@@ -24,7 +27,7 @@ from unittest import mock
import pytest
from buildstream._exceptions import ErrorDomain, LoadErrorReason
-from buildstream.testing import cli
+from buildstream.testing import cli # pylint: disable=unused-import
from tests.testutils import create_element_size, update_element_size, wait_for_cache_granularity
diff --git a/tests/artifactcache/junctions.py b/tests/artifactcache/junctions.py
index e1bbb31fd..52d721baf 100644
--- a/tests/artifactcache/junctions.py
+++ b/tests/artifactcache/junctions.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 shutil
import pytest
from buildstream import _yaml
-from buildstream.testing import cli
+from buildstream.testing import cli # pylint: disable=unused-import
from tests.testutils import create_artifact_share
diff --git a/tests/artifactcache/pull.py b/tests/artifactcache/pull.py
index cdadf583a..d5f2c1f06 100644
--- a/tests/artifactcache/pull.py
+++ b/tests/artifactcache/pull.py
@@ -1,3 +1,6 @@
+# Pylint doesn't play well with fixtures and dependency injection from pytest
+# pylint: disable=redefined-outer-name
+
import multiprocessing
import os
import signal
@@ -8,7 +11,7 @@ from buildstream import _yaml, _signals, utils
from buildstream._context import Context
from buildstream._project import Project
from buildstream._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
-from buildstream.testing import cli
+from buildstream.testing import cli # pylint: disable=unused-import
from tests.testutils import create_artifact_share
@@ -200,7 +203,6 @@ def test_pull_tree(cli, tmpdir, datafiles):
# Load the project and CAS cache
project = Project(project_dir, context)
project.ensure_fully_loaded()
- artifactcache = context.artifactcache
cas = context.get_cascache()
# Assert that the element's artifact is cached
diff --git a/tests/artifactcache/push.py b/tests/artifactcache/push.py
index 4f31148b7..1cf46a496 100644
--- a/tests/artifactcache/push.py
+++ b/tests/artifactcache/push.py
@@ -1,3 +1,6 @@
+# Pylint doesn't play well with fixtures and dependency injection from pytest
+# pylint: disable=redefined-outer-name
+
import multiprocessing
import os
import signal
@@ -8,8 +11,7 @@ from buildstream import _yaml, _signals, utils, Scope
from buildstream._context import Context
from buildstream._project import Project
from buildstream._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
-from buildstream.storage._casbaseddirectory import CasBasedDirectory
-from buildstream.testing import cli
+from buildstream.testing import cli # pylint: disable=unused-import
from tests.testutils import create_artifact_share