3838
3939TEST_CONFIG = {
4040 # You can opt out from the test for specific Python versions.
41- 'ignored_versions' : ["2.7" ],
42-
41+ "ignored_versions" : ["2.7" ],
4342 # Old samples are opted out of enforcing Python type hints
4443 # All new samples should feature them
45- 'enforce_type_hints' : False ,
46-
44+ "enforce_type_hints" : False ,
4745 # An envvar key for determining the project id to use. Change it
4846 # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
4947 # build specific Cloud project. You can also use your own string
5048 # to use your own Cloud project.
51- ' gcloud_project_env' : ' GOOGLE_CLOUD_PROJECT' ,
49+ " gcloud_project_env" : " GOOGLE_CLOUD_PROJECT" ,
5250 # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
5351 # If you need to use a specific version of pip,
5452 # change pip_version_override to the string representation
5553 # of the version number, for example, "20.2.4"
5654 "pip_version_override" : None ,
5755 # A dictionary you want to inject into your test. Don't put any
5856 # secrets here. These values will override predefined values.
59- ' envs' : {},
57+ " envs" : {},
6058}
6159
6260
6361try :
6462 # Ensure we can import noxfile_config in the project's directory.
65- sys .path .append ('.' )
63+ sys .path .append ("." )
6664 from noxfile_config import TEST_CONFIG_OVERRIDE
6765except ImportError as e :
6866 print ("No user noxfile_config found: detail: {}" .format (e ))
@@ -77,12 +75,12 @@ def get_pytest_env_vars() -> Dict[str, str]:
7775 ret = {}
7876
7977 # Override the GCLOUD_PROJECT and the alias.
80- env_key = TEST_CONFIG [' gcloud_project_env' ]
78+ env_key = TEST_CONFIG [" gcloud_project_env" ]
8179 # This should error out if not set.
82- ret [' GOOGLE_CLOUD_PROJECT' ] = os .environ [env_key ]
80+ ret [" GOOGLE_CLOUD_PROJECT" ] = os .environ [env_key ]
8381
8482 # Apply user supplied envs.
85- ret .update (TEST_CONFIG [' envs' ])
83+ ret .update (TEST_CONFIG [" envs" ])
8684 return ret
8785
8886
@@ -91,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
9189ALL_VERSIONS = ["2.7" , "3.6" , "3.7" , "3.8" , "3.9" ]
9290
9391# Any default versions that should be ignored.
94- IGNORED_VERSIONS = TEST_CONFIG [' ignored_versions' ]
92+ IGNORED_VERSIONS = TEST_CONFIG [" ignored_versions" ]
9593
9694TESTED_VERSIONS = sorted ([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS ])
9795
@@ -140,7 +138,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
140138
141139@nox .session
142140def lint (session : nox .sessions .Session ) -> None :
143- if not TEST_CONFIG [' enforce_type_hints' ]:
141+ if not TEST_CONFIG [" enforce_type_hints" ]:
144142 session .install ("flake8" , "flake8-import-order" )
145143 else :
146144 session .install ("flake8" , "flake8-import-order" , "flake8-annotations" )
@@ -149,9 +147,11 @@ def lint(session: nox.sessions.Session) -> None:
149147 args = FLAKE8_COMMON_ARGS + [
150148 "--application-import-names" ,
151149 "," .join (local_names ),
152- "."
150+ "." ,
153151 ]
154152 session .run ("flake8" , * args )
153+
154+
155155#
156156# Black
157157#
@@ -164,6 +164,7 @@ def blacken(session: nox.sessions.Session) -> None:
164164
165165 session .run ("black" , * python_files )
166166
167+
167168#
168169# Sample Tests
169170#
@@ -172,7 +173,9 @@ def blacken(session: nox.sessions.Session) -> None:
172173PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml" ]
173174
174175
175- def _session_tests (session : nox .sessions .Session , post_install : Callable = None ) -> None :
176+ def _session_tests (
177+ session : nox .sessions .Session , post_install : Callable = None
178+ ) -> None :
176179 if TEST_CONFIG ["pip_version_override" ]:
177180 pip_version = TEST_CONFIG ["pip_version_override" ]
178181 session .install (f"pip=={ pip_version } " )
@@ -202,7 +205,7 @@ def _session_tests(session: nox.sessions.Session, post_install: Callable = None)
202205 # on travis where slow and flaky tests are excluded.
203206 # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
204207 success_codes = [0 , 5 ],
205- env = get_pytest_env_vars ()
208+ env = get_pytest_env_vars (),
206209 )
207210
208211
@@ -212,9 +215,9 @@ def py(session: nox.sessions.Session) -> None:
212215 if session .python in TESTED_VERSIONS :
213216 _session_tests (session )
214217 else :
215- session .skip ("SKIPPED: {} tests are disabled for this sample." . format (
216- session .python
217- ))
218+ session .skip (
219+ "SKIPPED: {} tests are disabled for this sample." . format ( session .python )
220+ )
218221
219222
220223#
0 commit comments