Skip to content

Commit dc18351

Browse files
committed
Renaming lint helper env. var. names.
This is to make them more general for other tests which may want to limit the changeset. Also moving the local env. variable names into a helper script file to make them easier to access and reuse from other testing scripts.
1 parent c055ee8 commit dc18351

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

CONTRIBUTING.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ Coding Style
151151
- In order to make ``tox -e lint`` run faster, you can set some environment
152152
variables::
153153

154-
export GOOGLE_CLOUD_REMOTE_FOR_LINT="upstream"
155-
export GOOGLE_CLOUD_BRANCH_FOR_LINT="master"
154+
export GOOGLE_CLOUD_TESTING_REMOTE="upstream"
155+
export GOOGLE_CLOUD_TESTING_BRANCH="master"
156156

157157
By doing this, you are specifying the location of the most up-to-date
158158
version of ``google-cloud-python``. The the suggested remote name ``upstream``

scripts/run_pylint.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
import subprocess
3030
import sys
3131

32+
from script_utils import LOCAL_BRANCH_ENV
33+
from script_utils import LOCAL_REMOTE_ENV
34+
3235

3336
IGNORED_DIRECTORIES = [
3437
os.path.join('bigtable', 'google', 'cloud', 'bigtable', '_generated'),
@@ -148,9 +151,9 @@ def get_files_for_linting(allow_limited=True):
148151
One could potentially use ${TRAVIS_COMMIT_RANGE} to find a diff base but
149152
this value is not dependable.
150153
151-
To allow faster local ``tox`` runs, the environment variables
152-
``GOOGLE_CLOUD_REMOTE_FOR_LINT`` and ``GOOGLE_CLOUD_BRANCH_FOR_LINT`` can
153-
be set to specify a remote branch to diff against.
154+
To allow faster local ``tox`` runs, the local remote and local branch
155+
environment variables can be set to specify a remote branch to diff
156+
against.
154157
155158
:type allow_limited: bool
156159
:param allow_limited: Boolean indicating if a reduced set of files can
@@ -168,8 +171,8 @@ def get_files_for_linting(allow_limited=True):
168171
diff_base = 'origin/master'
169172
elif os.getenv('TRAVIS') is None:
170173
# Only allow specified remote and branch in local dev.
171-
remote = os.getenv('GOOGLE_CLOUD_REMOTE_FOR_LINT')
172-
branch = os.getenv('GOOGLE_CLOUD_BRANCH_FOR_LINT')
174+
remote = os.getenv(LOCAL_REMOTE_ENV)
175+
branch = os.getenv(LOCAL_BRANCH_ENV)
173176
if remote is not None and branch is not None:
174177
diff_base = '%s/%s' % (remote, branch)
175178

scripts/script_utils.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2016 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Common helpers for testing scripts."""
16+
17+
18+
LOCAL_REMOTE_ENV = 'GOOGLE_CLOUD_TESTING_REMOTE'
19+
LOCAL_BRANCH_ENV = 'GOOGLE_CLOUD_TESTING_BRANCH'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export GOOGLE_APPLICATION_CREDENTIALS="app_credentials.json.sample"
2-
export GOOGLE_CLOUD_REMOTE_FOR_LINT="upstream"
3-
export GOOGLE_CLOUD_BRANCH_FOR_LINT="master"
2+
export GOOGLE_CLOUD_TESTING_REMOTE="upstream"
3+
export GOOGLE_CLOUD_TESTING_BRANCH="master"
44
export GOOGLE_CLOUD_TESTS_API_KEY="abcd1234"

0 commit comments

Comments
 (0)