Skip to content

MNT:Decreased timeout for local interactive tests #26235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions lib/matplotlib/tests/test_backends_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,29 @@ def _get_testable_interactive_backends():
return envs


_test_timeout = 120 # A reasonably safe value for slower architectures.
def is_ci_environment():
# Common CI variables
ci_environment_variables = [
'CI', # Generic CI environment variable
'CONTINUOUS_INTEGRATION', # Generic CI environment variable
'TRAVIS', # Travis CI
'CIRCLECI', # CircleCI
'JENKINS', # Jenkins
'GITLAB_CI', # GitLab CI
'GITHUB_ACTIONS', # GitHub Actions
'TEAMCITY_VERSION' # TeamCity
# Add other CI environment variables as needed
]

for env_var in ci_environment_variables:
if os.getenv(env_var):
return True

return False


# Reasonable safe values for slower CI/Remote and local architectures.
_test_timeout = 120 if is_ci_environment() else 20


def _test_toolbar_button_la_mode_icon(fig):
Expand Down Expand Up @@ -204,15 +226,15 @@ def test_interactive_backend(env, toolbar):
pytest.skip("wx backend is deprecated; tests failed on appveyor")
try:
proc = _run_helper(
_test_interactive_impl,
json.dumps({"toolbar": toolbar}),
timeout=_test_timeout,
extra_env=env,
)
_test_interactive_impl,
json.dumps({"toolbar": toolbar}),
timeout=_test_timeout,
extra_env=env,
)
except subprocess.CalledProcessError as err:
pytest.fail(
"Subprocess failed to test intended behavior\n"
+ str(err.stderr))
"Subprocess failed to test intended behavior\n"
+ str(err.stderr))
assert proc.stdout.count("CloseEvent") == 1


Expand Down