Skip to content

Commit 2dbb9e5

Browse files
gcf-owl-bot[bot]dandhlee
authored andcommitted
chore: new owl bot post processor docker image (#177)
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:58c7342b0bccf85028100adaa3d856cb4a871c22ca9c01960d996e66c40548ce
1 parent 633f6c2 commit 2dbb9e5

File tree

2 files changed

+35
-39
lines changed

2 files changed

+35
-39
lines changed

speech/microphone/noxfile.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,31 @@
3838

3939
TEST_CONFIG = {
4040
# You can opt out from the test for specific Python versions.
41-
"ignored_versions": ["2.7"],
41+
'ignored_versions': ["2.7"],
42+
4243
# Old samples are opted out of enforcing Python type hints
4344
# All new samples should feature them
44-
"enforce_type_hints": False,
45+
'enforce_type_hints': False,
46+
4547
# An envvar key for determining the project id to use. Change it
4648
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
4749
# build specific Cloud project. You can also use your own string
4850
# to use your own Cloud project.
49-
"gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
51+
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
5052
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
5153
# If you need to use a specific version of pip,
5254
# change pip_version_override to the string representation
5355
# of the version number, for example, "20.2.4"
5456
"pip_version_override": None,
5557
# A dictionary you want to inject into your test. Don't put any
5658
# secrets here. These values will override predefined values.
57-
"envs": {},
59+
'envs': {},
5860
}
5961

6062

6163
try:
6264
# Ensure we can import noxfile_config in the project's directory.
63-
sys.path.append(".")
65+
sys.path.append('.')
6466
from noxfile_config import TEST_CONFIG_OVERRIDE
6567
except ImportError as e:
6668
print("No user noxfile_config found: detail: {}".format(e))
@@ -75,12 +77,12 @@ def get_pytest_env_vars() -> Dict[str, str]:
7577
ret = {}
7678

7779
# Override the GCLOUD_PROJECT and the alias.
78-
env_key = TEST_CONFIG["gcloud_project_env"]
80+
env_key = TEST_CONFIG['gcloud_project_env']
7981
# This should error out if not set.
80-
ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
82+
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
8183

8284
# Apply user supplied envs.
83-
ret.update(TEST_CONFIG["envs"])
85+
ret.update(TEST_CONFIG['envs'])
8486
return ret
8587

8688

@@ -89,7 +91,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
8991
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
9092

9193
# Any default versions that should be ignored.
92-
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
94+
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
9395

9496
TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
9597

@@ -138,7 +140,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
138140

139141
@nox.session
140142
def lint(session: nox.sessions.Session) -> None:
141-
if not TEST_CONFIG["enforce_type_hints"]:
143+
if not TEST_CONFIG['enforce_type_hints']:
142144
session.install("flake8", "flake8-import-order")
143145
else:
144146
session.install("flake8", "flake8-import-order", "flake8-annotations")
@@ -147,11 +149,9 @@ def lint(session: nox.sessions.Session) -> None:
147149
args = FLAKE8_COMMON_ARGS + [
148150
"--application-import-names",
149151
",".join(local_names),
150-
".",
152+
"."
151153
]
152154
session.run("flake8", *args)
153-
154-
155155
#
156156
# Black
157157
#
@@ -164,7 +164,6 @@ def blacken(session: nox.sessions.Session) -> None:
164164

165165
session.run("black", *python_files)
166166

167-
168167
#
169168
# Sample Tests
170169
#
@@ -213,9 +212,9 @@ def py(session: nox.sessions.Session) -> None:
213212
if session.python in TESTED_VERSIONS:
214213
_session_tests(session)
215214
else:
216-
session.skip(
217-
"SKIPPED: {} tests are disabled for this sample.".format(session.python)
218-
)
215+
session.skip("SKIPPED: {} tests are disabled for this sample.".format(
216+
session.python
217+
))
219218

220219

221220
#

speech/snippets/noxfile.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,31 @@
3838

3939
TEST_CONFIG = {
4040
# You can opt out from the test for specific Python versions.
41-
"ignored_versions": ["2.7"],
41+
'ignored_versions': ["2.7"],
42+
4243
# Old samples are opted out of enforcing Python type hints
4344
# All new samples should feature them
44-
"enforce_type_hints": False,
45+
'enforce_type_hints': False,
46+
4547
# An envvar key for determining the project id to use. Change it
4648
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
4749
# build specific Cloud project. You can also use your own string
4850
# to use your own Cloud project.
49-
"gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
51+
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
5052
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
5153
# If you need to use a specific version of pip,
5254
# change pip_version_override to the string representation
5355
# of the version number, for example, "20.2.4"
5456
"pip_version_override": None,
5557
# A dictionary you want to inject into your test. Don't put any
5658
# secrets here. These values will override predefined values.
57-
"envs": {},
59+
'envs': {},
5860
}
5961

6062

6163
try:
6264
# Ensure we can import noxfile_config in the project's directory.
63-
sys.path.append(".")
65+
sys.path.append('.')
6466
from noxfile_config import TEST_CONFIG_OVERRIDE
6567
except ImportError as e:
6668
print("No user noxfile_config found: detail: {}".format(e))
@@ -75,12 +77,12 @@ def get_pytest_env_vars() -> Dict[str, str]:
7577
ret = {}
7678

7779
# Override the GCLOUD_PROJECT and the alias.
78-
env_key = TEST_CONFIG["gcloud_project_env"]
80+
env_key = TEST_CONFIG['gcloud_project_env']
7981
# This should error out if not set.
80-
ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
82+
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
8183

8284
# Apply user supplied envs.
83-
ret.update(TEST_CONFIG["envs"])
85+
ret.update(TEST_CONFIG['envs'])
8486
return ret
8587

8688

@@ -89,7 +91,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
8991
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
9092

9193
# Any default versions that should be ignored.
92-
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
94+
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
9395

9496
TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
9597

@@ -138,7 +140,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
138140

139141
@nox.session
140142
def lint(session: nox.sessions.Session) -> None:
141-
if not TEST_CONFIG["enforce_type_hints"]:
143+
if not TEST_CONFIG['enforce_type_hints']:
142144
session.install("flake8", "flake8-import-order")
143145
else:
144146
session.install("flake8", "flake8-import-order", "flake8-annotations")
@@ -147,11 +149,9 @@ def lint(session: nox.sessions.Session) -> None:
147149
args = FLAKE8_COMMON_ARGS + [
148150
"--application-import-names",
149151
",".join(local_names),
150-
".",
152+
"."
151153
]
152154
session.run("flake8", *args)
153-
154-
155155
#
156156
# Black
157157
#
@@ -164,7 +164,6 @@ def blacken(session: nox.sessions.Session) -> None:
164164

165165
session.run("black", *python_files)
166166

167-
168167
#
169168
# Sample Tests
170169
#
@@ -173,9 +172,7 @@ def blacken(session: nox.sessions.Session) -> None:
173172
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
174173

175174

176-
def _session_tests(
177-
session: nox.sessions.Session, post_install: Callable = None
178-
) -> None:
175+
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
179176
if TEST_CONFIG["pip_version_override"]:
180177
pip_version = TEST_CONFIG["pip_version_override"]
181178
session.install(f"pip=={pip_version}")
@@ -205,7 +202,7 @@ def _session_tests(
205202
# on travis where slow and flaky tests are excluded.
206203
# See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
207204
success_codes=[0, 5],
208-
env=get_pytest_env_vars(),
205+
env=get_pytest_env_vars()
209206
)
210207

211208

@@ -215,9 +212,9 @@ def py(session: nox.sessions.Session) -> None:
215212
if session.python in TESTED_VERSIONS:
216213
_session_tests(session)
217214
else:
218-
session.skip(
219-
"SKIPPED: {} tests are disabled for this sample.".format(session.python)
220-
)
215+
session.skip("SKIPPED: {} tests are disabled for this sample.".format(
216+
session.python
217+
))
221218

222219

223220
#
@@ -226,7 +223,7 @@ def py(session: nox.sessions.Session) -> None:
226223

227224

228225
def _get_repo_root() -> Optional[str]:
229-
"""Returns the root folder of the project."""
226+
""" Returns the root folder of the project. """
230227
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
231228
p = Path(os.getcwd())
232229
for i in range(10):

0 commit comments

Comments
 (0)