Skip to content

Commit 43c22f5

Browse files
partheaholtskinner
authored andcommitted
chore: migrate to owl bot (#130)
1 parent 97a834c commit 43c22f5

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

noxfile.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,28 @@
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',
53+
5154
# A dictionary you want to inject into your test. Don't put any
5255
# secrets here. These values will override predefined values.
53-
"envs": {},
56+
'envs': {},
5457
}
5558

5659

5760
try:
5861
# Ensure we can import noxfile_config in the project's directory.
59-
sys.path.append(".")
62+
sys.path.append('.')
6063
from noxfile_config import TEST_CONFIG_OVERRIDE
6164
except ImportError as e:
6265
print("No user noxfile_config found: detail: {}".format(e))
@@ -71,12 +74,12 @@ def get_pytest_env_vars() -> Dict[str, str]:
7174
ret = {}
7275

7376
# Override the GCLOUD_PROJECT and the alias.
74-
env_key = TEST_CONFIG["gcloud_project_env"]
77+
env_key = TEST_CONFIG['gcloud_project_env']
7578
# This should error out if not set.
76-
ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
79+
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
7780

7881
# Apply user supplied envs.
79-
ret.update(TEST_CONFIG["envs"])
82+
ret.update(TEST_CONFIG['envs'])
8083
return ret
8184

8285

@@ -85,7 +88,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
8588
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
8689

8790
# Any default versions that should be ignored.
88-
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
91+
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
8992

9093
TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
9194

@@ -134,7 +137,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
134137

135138
@nox.session
136139
def lint(session: nox.sessions.Session) -> None:
137-
if not TEST_CONFIG["enforce_type_hints"]:
140+
if not TEST_CONFIG['enforce_type_hints']:
138141
session.install("flake8", "flake8-import-order")
139142
else:
140143
session.install("flake8", "flake8-import-order", "flake8-annotations")
@@ -143,11 +146,9 @@ def lint(session: nox.sessions.Session) -> None:
143146
args = FLAKE8_COMMON_ARGS + [
144147
"--application-import-names",
145148
",".join(local_names),
146-
".",
149+
"."
147150
]
148151
session.run("flake8", *args)
149-
150-
151152
#
152153
# Black
153154
#
@@ -160,7 +161,6 @@ def blacken(session: nox.sessions.Session) -> None:
160161

161162
session.run("black", *python_files)
162163

163-
164164
#
165165
# Sample Tests
166166
#
@@ -169,9 +169,7 @@ def blacken(session: nox.sessions.Session) -> None:
169169
PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
170170

171171

172-
def _session_tests(
173-
session: nox.sessions.Session, post_install: Callable = None
174-
) -> None:
172+
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
175173
"""Runs py.test for a particular project."""
176174
if os.path.exists("requirements.txt"):
177175
if os.path.exists("constraints.txt"):
@@ -208,9 +206,9 @@ def py(session: nox.sessions.Session) -> None:
208206
if session.python in TESTED_VERSIONS:
209207
_session_tests(session)
210208
else:
211-
session.skip(
212-
"SKIPPED: {} tests are disabled for this sample.".format(session.python)
213-
)
209+
session.skip("SKIPPED: {} tests are disabled for this sample.".format(
210+
session.python
211+
))
214212

215213

216214
#

0 commit comments

Comments
 (0)