-
-
Notifications
You must be signed in to change notification settings - Fork 33k
bpo-38614: Add timeout constants to test.support #16964
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
Conversation
Somehow related, in 2014, I tried to make time.sleep() calls configurable in tests: https://bugs.python.org/issue20910 |
@pablogsal: Would you mind to review this PR? I'm not sure about the documentation of SHORT_TIMEOUT vs LONG_TIMEOUT. LONG_TIMEOUT is 10 times larger than SHORT_TIMEOUT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this @vstinner ! 🎉
I left some comments regarding style and minor nits!
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: should we add markup links to connect()
, recv()
...?
Basically `connect` -> :meth:`socket.socket.connect`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or perhaps :meth:~socket.socket.connect
to avoid showing the fully-qualified name,
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Markup link to socket.socket
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps not needed if the methods are linked.
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, a timeout using INTERNET_TIMEOUT should not mark a test a failed, | |
Usually, a timeout using INTERNET_TIMEOUT should not mark a test as failed, |
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: link to transient_internet
if it makes sense.
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slower. It is not designed to measure a function performance. | |
It is not designed to measure a function performance. |
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enough to reduce the risk of test failure on the slowest Python buildbot | |
enough to reduce the risk of test failure on the slowest Python buildbot. |
Lib/test/libregrtest/setup.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# For slowest buildbot worker, increase SHORT_TIMEOUT and LONG_TIMEOUT | |
# For a slow buildbot worker, increase SHORT_TIMEOUT and LONG_TIMEOUT |
Lib/test/support/__init__.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# long enough to prevent test failure: it takes an account that the client and | |
# long enough to prevent test failure: it takes into account that the client and |
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent test failure: it takes an account that the client and the server can | |
prevent test failure: it takes into account that the client and the server can |
Lib/test/support/__init__.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Usually, a timeout using INTERNET_TIMEOUT should not mark a test a failed, | |
# Usually, a timeout using INTERNET_TIMEOUT should not mark a test as failed, |
Hummmm, maybe:
|
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or perhaps :meth:~socket.socket.connect
to avoid showing the fully-qualified name,
Doc/library/test.rst
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps not needed if the methods are linked.
Lib/test/support/__init__.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this special value rather than None
, as in the other cases? Is it to support None
as an actual timeout value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one test_socket test which requires timeout=None.
Add timeout constants to test.support: * LOOPBACK_TIMEOUT * INTERNET_TIMEOUT * SHORT_TIMEOUT * LONG_TIMEOUT
@pablogsal: I rephased the documentation to better distinguish SHORT and LONG timeout. Does it sound better to you? I took your review in account. I checked manually the HTML documentation to ensure that it's rendered properly ;-) I revert changes to use new timeouts, except test_socket and _test_multiprocessing to make this PR easier to review. I will write more PRs to use the new constants, I start to modify tons of tests, I prefer to have separated PRs to make them easier to review. |
Much better indeed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
Add timeout constants to test.support: * LOOPBACK_TIMEOUT * INTERNET_TIMEOUT * SHORT_TIMEOUT * LONG_TIMEOUT
Add timeout constants to test.support: * LOOPBACK_TIMEOUT * INTERNET_TIMEOUT * SHORT_TIMEOUT * LONG_TIMEOUT
Add timeout constants to test.support:
https://bugs.python.org/issue38614