@@ -111,6 +111,7 @@ def system(session):
111
111
"""Run the system test suite."""
112
112
system_test_path = os .path .join ("tests" , "system.py" )
113
113
system_test_folder_path = os .path .join ("tests" , "system" )
114
+ rerun_count = 0
114
115
115
116
# Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
116
117
if os .environ .get ("RUN_SYSTEM_TESTS" , "true" ) == "false" :
@@ -121,6 +122,12 @@ def system(session):
121
122
# mTLS tests requires pyopenssl.
122
123
if os .environ .get ("GOOGLE_API_USE_CLIENT_CERTIFICATE" , "" ) == "true" :
123
124
session .install ("pyopenssl" )
125
+ # Check if endpoint is being overriden for rerun_count
126
+ if (
127
+ os .getenv ("API_ENDPOINT_OVERRIDE" , "https://storage.googleapis.com" )
128
+ != "https://storage.googleapis.com"
129
+ ):
130
+ rerun_count = 3
124
131
125
132
system_test_exists = os .path .exists (system_test_path )
126
133
system_test_folder_exists = os .path .exists (system_test_folder_path )
@@ -152,13 +159,17 @@ def system(session):
152
159
# Run py.test against the system tests.
153
160
if system_test_exists :
154
161
session .run (
155
- "py.test" , "--quiet" , "--reruns=2" , system_test_path , * session .posargs
162
+ "py.test" ,
163
+ "--quiet" ,
164
+ "--reruns={}" .format (rerun_count ),
165
+ system_test_path ,
166
+ * session .posargs ,
156
167
)
157
168
if system_test_folder_exists :
158
169
session .run (
159
170
"py.test" ,
160
171
"--quiet" ,
161
- "--reruns=2" ,
172
+ "--reruns={}" . format ( rerun_count ) ,
162
173
system_test_folder_path ,
163
174
* session .posargs ,
164
175
)
0 commit comments