Skip to content
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

Change error message to clearly relate it to pytest-timeout #180

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pedro-psb
Copy link

@pedro-psb pedro-psb commented Sep 27, 2024

Is should have less than 60 chars for most timeout values and is more direct than the one I proposed in the issue.

Closes #179

Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like that the plugin name and the timeout time ar now part of the error for clarity

i wonder if we ought to set out to make the timeout a OutcomeExcpetion (like with fail/skip/xfail in core ) as a eventual followup

@@ -495,7 +495,7 @@ def timeout_sigalrm(item, settings):
dump_stacks(terminal)
if nthreads > 1:
terminal.sep("+", title="Timeout")
pytest.fail("Timeout >%ss" % settings.timeout)
pytest.fail("Timeout (>%ss) from pytest-timeout plugin." % settings.timeout)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a nitpick for consideration - the word plugin at the end may not be necessary

As suggested, removed the unecessary 'plugin' word.
Also, extracted the message to a constant.
@@ -21,7 +21,7 @@
__all__ = ("is_debugging", "Settings")
SESSION_TIMEOUT_KEY = pytest.StashKey[float]()
SESSION_EXPIRE_KEY = pytest.StashKey[float]()

PYTEST_FAILURE_MESSAGE = "Timeout (>%ss) from pytest-timeout."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PYTEST_FAILURE_MESSAGE = "Timeout (>%ss) from pytest-timeout."
PYTEST_FAILURE_TEMPLATE = "Timeout (>%ss) from pytest-timeout."

maybe? It's a little confusing otherwise to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customize pytest error message
4 participants