10000 chore: only run 2.7 tests for GAE (#3116) · larkee/python-docs-samples@307b032 · GitHub
[go: up one dir, main page]

Skip to content

Commit 307b032

Browse files
authored
chore: only run 2.7 tests for GAE (GoogleCloudPlatform#3116)
This runs 2.7 tests only for GAE Standard samples. The second commit intentionally touched files in every directory to trigger CI. The real changes to the noxfiles and kokoro are in the [first commit](GoogleCloudPlatform@15e30db). I will revert the spurious License header commit before merging. :)
1 parent f4a51dd commit 307b032

File tree

3 files changed

+10
-62
lines changed

3 files changed

+10
-62
lines changed

.kokoro/python2.7/common.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ action {
4141
# Specify which tests to run
4242
env_vars: {
4343
key: "RUN_TESTS_SESSION"
44-
value: "py2"
44+
value: "gae"
4545
}

noxfile-template.py

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,9 @@ def _setup_appengine_sdk(session):
139139
"appengine/standard/"
140140
)
141141
]
142-
PY3_ONLY_SAMPLES = [
143-
sample
144-
for sample in ALL_TESTED_SAMPLES
145-
if (
146-
str(Path(sample).absolute().relative_to(REPO_ROOT)).startswith(
147-
"appengine/standard_python37"
148-
)
149-
or str(Path(sample).absolute().relative_to(REPO_ROOT)).startswith(
150-
"appengine/flexible/django_cloudsql"
151-
)
152-
or str(Path(sample).absolute().relative_to(REPO_ROOT)).startswith("functions/")
153-
or str(Path(sample).absolute().relative_to(REPO_ROOT)).startswith(
154-
"bigquery/pandas-gbq-migration"
155-
)
156-
or str(Path(sample).absolute().relative_to(REPO_ROOT)).startswith(
157-
"run/"
158-
)
159-
)
160-
]
161-
NON_GAE_STANDARD_SAMPLES_PY2 = sorted(
162-
list((set(ALL_TESTED_SAMPLES) - set(GAE_STANDARD_SAMPLES)) - set(PY3_ONLY_SAMPLES))
163-
)
142+
143+
PY2_ONLY_SAMPLES = GAE_STANDARD_SAMPLES
144+
164145
NON_GAE_STANDARD_SAMPLES_PY3 = sorted(
165146
list(set(ALL_TESTED_SAMPLES) - set(GAE_STANDARD_SAMPLES))
166147
)
@@ -189,7 +170,7 @@ def _session_tests(session, sample, post_install=None):
189170

190171

191172
@nox.session(python="2.7")
192-
@nox.parametrize("sample", GAE_STANDARD_SAMPLES)
173+
@nox.parametrize("sample", PY2_ONLY_SAMPLES)
193174
def gae(session, sample):
194175
"""Runs py.test for an App Engine standard sample."""
195176

@@ -199,14 +180,7 @@ def gae(session, sample):
199180
os.mkdir(os.path.join(sample, "lib"))
200181

201182
_session_tests(session, sample, _setup_appengine_sdk)
202-
203-
204-
@nox.session(python="2.7")
205-
@nox.parametrize("sample", NON_GAE_STANDARD_SAMPLES_PY2)
206-
def py2(session, sample):
207-
"""Runs py.test for a sample using Python 2.7"""
208-
_session_tests(session, sample)
209-
183+
210184

211185
@nox.session(python=["3.6", "3.7"])
212186
@nox.parametrize("sample", NON_GAE_STANDARD_SAMPLES_PY3)

noxfile.py

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -167,26 +167,11 @@ def _setup_appengine_sdk(session):
167167
for sample in ALL_TESTED_SAMPLES
168168
if sample.startswith("./appengine/standard/")
169169
]
170-
PY2_ONLY_SAMPLES = GAE_STANDARD_SAMPLES
171-
PY3_ONLY_SAMPLES = [
172-
sample
173-
for sample in ALL_TESTED_SAMPLES
174-
if (
175-
sample.startswith("./appengine/standard_python37")
176-
or sample.startswith("./functions/")
177-
or sample.startswith("./bigquery/pandas-gbq-migration")
178-
or sample.startswith("./run/system-package")
179-
or sample.startswith("./run/hello-broken")
180-
)
181-
]
182-
NON_GAE_STANDARD_SAMPLES_PY2 = sorted(
183-
list((set(ALL_TESTED_SAMPLES) - set(GAE_STANDARD_SAMPLES)) - set(PY3_ONLY_SAMPLES))
184-
)
170+
185171
NON_GAE_STANDARD_SAMPLES_PY3 = sorted(
186-
list(set(ALL_TESTED_SAMPLES) - set(PY2_ONLY_SAMPLES))
172+
list(set(ALL_TESTED_SAMPLES) - set(GAE_STANDARD_SAMPLES))
187173
)
188174

189-
190175
# Filter sample directories if on a CI like Travis or Circle to only run tests
191176
# for changed samples.
192177
CHANGED_FILES = _get_changed_files()
@@ -196,13 +181,9 @@ def _setup_appengine_sdk(session):
196181
ALL_TESTED_SAMPLES = _filter_samples(ALL_TESTED_SAMPLES, CHANGED_FILES)
197182
ALL_SAMPLE_DIRECTORIES = _filter_samples(ALL_SAMPLE_DIRECTORIES, CHANGED_FILES)
198183
GAE_STANDARD_SAMPLES = _filter_samples(GAE_STANDARD_SAMPLES, CHANGED_FILES)
199-
NON_GAE_STANDARD_SAMPLES_PY2 = _filter_samples(
200-
NON_GAE_STANDARD_SAMPLES_PY2, CHANGED_FILES
184+
NON_GAE_STANDARD_SAMPLES_PY3 = _filter_samples(
185+
NON_GAE_STANDARD_SAMPLES_PY3, CHANGED_FILES
201186
)
202-
NON_GAE_STANDARD_SAMPLES_PY3 = _filter_samples(
203-
NON_GAE_STANDARD_SAMPLES_PY3, CHANGED_FILES
204-
)
205-
206187

207188
def _session_tests(session, sample, post_install=None):
208189
"""Runs py.test for a particular sample."""
@@ -239,13 +220,6 @@ def gae(session, sample):
239220
_session_tests(session, sample, _setup_appengine_sdk)
240221

241222

242-
@nox.session(python="2.7")
243-
@nox.parametrize("sample", NON_GAE_STANDARD_SAMPLES_PY2)
244-
def py27(session, sample):
245-
"""Runs py.test for a sample using Python 2.7"""
246-
_session_tests(session, sample)
247-
248-
249223
@nox.session(python="3.6")
250224
@nox.parametrize("sample", NON_GAE_STANDARD_SAMPLES_PY3)
251225
def py36(session, sample):

0 commit comments

Comments
 (0)
0