@@ -79,7 +79,29 @@ def _get_testable_interactive_backends():
7979 return envs
8080
8181
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
83105
84106
85107def _test_toolbar_button_la_mode_icon (fig ):
@@ -204,15 +226,15 @@ def test_interactive_backend(env, toolbar):
204226 pytest .skip ("wx backend is deprecated; tests failed on appveyor" )
205227 try :
206228 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+ )
212234 except subprocess .CalledProcessError as err :
213235 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 ))
216238 assert proc .stdout .count ("CloseEvent" ) == 1
217239
218240
0 commit comments