Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4307a9d

Browse filesBrowse files
committed
Configure appengine/standard to only test Python 2.7.
1 parent 160cd78 commit 4307a9d
Copy full SHA for 4307a9d

File tree

Expand file treeCollapse file tree

5 files changed

+260
-0
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+260
-0
lines changed

‎.kokoro/python3.8/common.cfg

Copy file name to clipboard
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2019 Google LLC
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+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
timeout_mins: 300
18+
19+
# Configure the docker image for kokoro-trampoline.
20+
env_vars: {
21+
key: "TRAMPOLINE_IMAGE"
22+
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
23+
}
24+
25+
# Download trampoline resources.
26+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
27+
28+
# Use the trampoline script to run in docker.
29+
build_file: "python-docs-samples/.kokoro/trampoline.sh"
30+
31+
# Download secrets from Cloud Storage.
32+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
33+
34+
# Copy results for Resultstore
35+
action {
36+
define_artifacts {
37+
regex: "**/*sponge_log.xml"
38+
}
39+
}
40+
41+
# Specify which tests to run
42+
env_vars: {
43+
key: "RUN_TESTS_SESSION"
44+
value: "py-3.7"
45+
}

‎.kokoro/python3.8/continuous.cfg

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2020 Google LLC
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+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Tell the trampoline which build file to use.
18+
env_vars: {
19+
key: "TRAMPOLINE_BUILD_FILE"
20+
value: "github/python-docs-samples/.kokoro/tests/run_tests.sh"
21+
}

‎.kokoro/python3.8/periodic.cfg

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2020 Google LLC
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+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Tell the trampoline which build file to use.
18+
env_vars: {
19+
key: "TRAMPOLINE_BUILD_FILE"
20+
value: "github/python-docs-samples/.kokoro/tests/run_tests.sh"
21+
}

‎.kokoro/python3.8/presubmit.cfg

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2019 Google LLC
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+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
# Tell the trampoline which build file to use.
18+
env_vars: {
19+
key: "TRAMPOLINE_BUILD_FILE"
20+
value: "github/python-docs-samples/.kokoro/tests/run_tests_only_diff.sh"
21+
}
+152Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Copyright 2019 Google LLC
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+
from __future__ import print_function
16+
17+
import os
18+
from pathlib import Path
19+
20+
import nox
21+
22+
23+
# DO NOT EDIT - automatically generated.
24+
# All versions used to tested samples.
25+
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"]
26+
27+
# Any default versions that should be ignored.
28+
IGNORED_VERSIONS = ["3.6", "3.7", "3.8"]
29+
30+
TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
31+
32+
#
33+
# Style Checks
34+
#
35+
36+
37+
# Ignore I202 "Additional newline in a section of imports." to accommodate
38+
# region tags in import blocks. Since we specify an explicit ignore, we also
39+
# have to explicitly ignore the list of default ignores:
40+
# `E121,E123,E126,E226,E24,E704,W503,W504` as shown by `flake8 --help`.
41+
def _determine_local_import_names(start_dir):
42+
"""Determines all import names that should be considered "local".
43+
44+
This is used when running the linter to insure that import order is
45+
properly checked.
46+
"""
47+
file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
48+
return [
49+
basename
50+
for basename, extension in file_ext_pairs
51+
if extension == ".py"
52+
or os.path.isdir(os.path.join(start_dir, basename))
53+
and basename not in ("__pycache__")
54+
]
55+
56+
57+
FLAKE8_COMMON_ARGS = [
58+
"--show-source",
59+
"--builtin='gettext'",
60+
"--max-complexity=20",
61+
"--import-order-style=google",
62+
"--exclude='.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py'",
63+
"--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I100,I201,I202",
64+
"--max-line-length=88",
65+
]
66+
67+
68+
@nox.session
69+
def lint(session):
70+
session.install("flake8", "flake8-import-order")
71+
72+
local_names = _determine_local_import_names(".")
73+
args = FLAKE8_COMMON_ARGS + [
74+
"--application-import-names",
75+
",".join(local_names),
76+
".",
77+
]
78+
session.run("flake8", *args)
79+
80+
81+
#
82+
# Sample Tests
83+
#
84+
85+
86+
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
87+
88+
89+
def _session_tests(session, post_install=None):
90+
"""Runs py.test for a particular project."""
91+
if os.path.exists("requirements.txt"):
92+
session.install("-r", "requirements.txt")
93+
94+
if os.path.exists("requirements-testing.txt"):
95+
session.install("-r", "requirements-testing.txt")
96+
97+
if post_install:
98+
post_install(session)
99+
100+
session.run(
101+
"pytest",
102+
*(PYTEST_COMMON_ARGS + session.posargs),
103+
# Pytest will return 5 when no tests are collected. This can happen
104+
# on travis where slow and flaky tests are excluded.
105+
# See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
106+
success_codes=[0, 5]
107+
)
108+
109+
110+
@nox.session(python=ALL_VERSIONS)
111+
def py(session):
112+
"""Runs py.test for a sample using the specified version of Python."""
113+
if session.python in TESTED_VERSIONS:
114+
_session_tests(session)
115+
else:
116+
print("SUCCESS: {} tests are disable for this sample.".format(session.python))
117+
118+
119+
#
120+
# Readmegen
121+
#
122+
123+
124+
def _get_repo_root():
125+
""" Returns the root folder of the project. """
126+
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
127+
p = Path(os.getcwd())
128+
for i in range(10):
129+
if p is None:
130+
break
131+
if Path(p / ".git").exists():
132+
return str(p)
133+
p = p.parent
134+
raise Exception("Unable to detect repository root.")
135+
136+
137+
GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")])
138+
139+
140+
@nox.session
141+
@nox.parametrize("path", GENERATED_READMES)
142+
def readmegen(session, path):
143+
"""(Re-)generates the readme for a sample."""
144+
session.install("jinja2", "pyyaml")
145+
146+
if os.path.exists(os.path.join(path, "requirements.txt")):
147+
session.install("-r", os.path.join(path, "requirements.txt"))
148+
149+
in_file = os.path.join(path, "README.rst.in")
150+
session.run(
151+
"python", _get_repo_root() + "/scripts/readme-gen/readme_gen.py", in_file
152+
)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.