@@ -79,7 +79,29 @@ def _get_testable_interactive_backends():
79
79
return envs
80
80
81
81
82
- _test_timeout = 120 # A reasonably safe value for slower architectures.
82
+ def is_ci_environment ():
83
+ # Common CI variables
84
+ ci_environment_variables = [
85
+ 'CI' , # Generic CI environment variable
86
+ 'CONTINUOUS_INTEGRATION' , # Generic CI environment variable
87
+ 'TRAVIS' , # Travis CI
88
+ 'CIRCLECI' , # CircleCI
89
+ 'JENKINS' , # Jenkins
90
+ 'GITLAB_CI' , # GitLab CI
91
+ 'GITHUB_ACTIONS' , # GitHub Actions
92
+ 'TEAMCITY_VERSION' # TeamCity
93
+ # Add other CI environment variables as needed
94
+ ]
95
+
96
+ for env_var in ci_environment_variables :
97
+ if os .getenv (env_var ):
98
+ return True
99
+
100
+ return False
101
+
102
+
103
+ # Reasonable safe values for slower CI/Remote and local architectures.
104
+ _test_timeout = 120 if is_ci_environment () else 20
83
105
84
106
85
107
def _test_toolbar_button_la_mode_icon (fig ):
@@ -204,15 +226,15 @@ def test_interactive_backend(env, toolbar):
204
226
pytest .skip ("wx backend is deprecated; tests failed on appveyor" )
205
227
try :
206
228
proc = _run_helper (
207
- _test_interactive_impl ,
208
- json .dumps ({"toolbar" : toolbar }),
209
- timeout = _test_timeout ,
210
- extra_env = env ,
211
- )
229
+ _test_interactive_impl ,
230
+ json .dumps ({"toolbar" : toolbar }),
231
+ timeout = _test_timeout ,
232
+ extra_env = env ,
233
+ )
212
234
except subprocess .CalledProcessError as err :
213
235
pytest .fail (
214
- "Subprocess failed to test intended behavior\n "
215
- + str (err .stderr ))
236
+ "Subprocess failed to test intended behavior\n "
237
+ + str (err .stderr ))
216
238
assert proc .stdout .count ("CloseEvent" ) == 1
217
239
218
240
0 commit comments