37
37
38
38
TEST_CONFIG = {
39
39
# You can opt out from the test for specific Python versions.
40
- 'ignored_versions' : ["2.7" ],
41
-
40
+ "ignored_versions" : ["2.7" ],
42
41
# Old samples are opted out of enforcing Python type hints
43
42
# All new samples should feature them
44
- 'enforce_type_hints' : False ,
45
-
43
+ "enforce_type_hints" : False ,
46
44
# An envvar key for determining the project id to use. Change it
47
45
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
48
46
# build specific Cloud project. You can also use your own string
49
47
# to use your own Cloud project.
50
- ' gcloud_project_env' : ' GOOGLE_CLOUD_PROJECT' ,
48
+ " gcloud_project_env" : " GOOGLE_CLOUD_PROJECT" ,
51
49
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
52
-
53
50
# A dictionary you want to inject into your test. Don't put any
54
51
# secrets here. These values will override predefined values.
55
- ' envs' : {},
52
+ " envs" : {},
56
53
}
57
54
58
55
59
56
try :
60
57
# Ensure we can import noxfile_config in the project's directory.
61
- sys .path .append ('.' )
58
+ sys .path .append ("." )
62
59
from noxfile_config import TEST_CONFIG_OVERRIDE
63
60
except ImportError as e :
64
61
print ("No user noxfile_config found: detail: {}" .format (e ))
@@ -73,12 +70,12 @@ def get_pytest_env_vars():
73
70
ret = {}
74
71
75
72
# Override the GCLOUD_PROJECT and the alias.
76
- env_key = TEST_CONFIG [' gcloud_project_env' ]
73
+ env_key = TEST_CONFIG [" gcloud_project_env" ]
77
74
# This should error out if not set.
78
- ret [' GOOGLE_CLOUD_PROJECT' ] = os .environ [env_key ]
75
+ ret [" GOOGLE_CLOUD_PROJECT" ] = os .environ [env_key ]
79
76
80
77
# Apply user supplied envs.
81
- ret .update (TEST_CONFIG [' envs' ])
78
+ ret .update (TEST_CONFIG [" envs" ])
82
79
return ret
83
80
84
81
@@ -87,7 +84,7 @@ def get_pytest_env_vars():
87
84
ALL_VERSIONS = ["2.7" , "3.6" , "3.7" , "3.8" ]
88
85
89
86
# Any default versions that should be ignored.
90
- IGNORED_VERSIONS = TEST_CONFIG [' ignored_versions' ]
87
+ IGNORED_VERSIONS = TEST_CONFIG [" ignored_versions" ]
91
88
92
89
TESTED_VERSIONS = sorted ([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS ])
93
90
@@ -136,7 +133,7 @@ def _determine_local_import_names(start_dir):
136
133
137
134
@nox .session
138
135
def lint (session ):
139
- if not TEST_CONFIG [' enforce_type_hints' ]:
136
+ if not TEST_CONFIG [" enforce_type_hints" ]:
140
137
session .install ("flake8" , "flake8-import-order" )
141
138
else :
142
139
session .install ("flake8" , "flake8-import-order" , "flake8-annotations" )
@@ -145,9 +142,11 @@ def lint(session):
145
142
args = FLAKE8_COMMON_ARGS + [
146
143
"--application-import-names" ,
147
144
"," .join (local_names ),
148
- "."
145
+ "." ,
149
146
]
150
147
session .run ("flake8" , * args )
148
+
149
+
151
150
#
152
151
# Black
153
152
#
@@ -160,6 +159,7 @@ def blacken(session):
160
159
161
160
session .run ("black" , * python_files )
162
161
162
+
163
163
#
164
164
# Sample Tests
165
165
#
@@ -199,9 +199,9 @@ def py(session):
199
199
if session .python in TESTED_VERSIONS :
200
200
_session_tests (session )
201
201
else :
202
- session .skip ("SKIPPED: {} tests are disabled for this sample." . format (
203
- session .python
204
- ))
202
+ session .skip (
203
+ "SKIPPED: {} tests are disabled for this sample." . format ( session .python )
204
+ )
205
205
206
206
207
207
#
0 commit comments