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