gh-120048: Make test_imaplib faster#120050
Conversation
The `test_imaplib` was taking 40+ minutes in the refleak build bots because we were using LOOPBACK_TIMEOUT for tests cases that expect to timeout. LOOPBACK_TIMEOUT scales with the global timeout. We should use a fixed, very small timeout for cases that we expect to timeout.
| client = self.imap_class("localhost", addr, timeout=FAST_TIMEOUT) | ||
| self.assertEqual(client.sock.timeout, FAST_TIMEOUT) |
There was a problem hiding this comment.
Should not an explicit timeout be different from SimpleIMAPHandler.timeout? Otherwise we cannot know how the value of client.sock.timeout was set.
You perhaps can use expect_timeout() as a context manager instead of a decorator.
There was a problem hiding this comment.
I misunderstood the problem with this test -- these connections should not time out. The problem was that the call self._setup(SimpleIMAPHandler) created a client and the remainder of the test did not run until that client timedout.
We should use self._setup(SimpleIMAPHandler, connect=False)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
!buildbot AMD64 Ubuntu NoGIL Refleaks |
|
🤖 New build scheduled with the buildbot fleet by @colesbury for commit fcce846 🤖 The command will test the builders whose names match following regular expression: The builders matched are:
|
|
Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
The `test_imaplib` was taking 40+ minutes in the refleak build bots because the tests waiting on a client `self._setup()` was creating a client that prevented progress until its connection timed out, which scaled with the global timeout. We should set `connect=False` for the tests that don't want `_setup()` to create a client. (cherry picked from commit 710cbea) Co-authored-by: Sam Gross <colesbury@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-120069 is a backport of this pull request to the 3.13 branch. |
The `test_imaplib` was taking 40+ minutes in the refleak build bots because the tests waiting on a client `self._setup()` was creating a client that prevented progress until its connection timed out, which scaled with the global timeout. We should set `connect=False` for the tests that don't want `_setup()` to create a client. (cherry picked from commit 710cbea) Co-authored-by: Sam Gross <colesbury@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
GH-120070 is a backport of this pull request to the 3.12 branch. |
The `test_imaplib` was taking 40+ minutes in the refleak build bots because the tests waiting on a client `self._setup()` was creating a client that prevented progress until its connection timed out, which scaled with the global timeout. We should set `connect=False` for the tests that don't want `_setup()` to create a client. (cherry picked from commit 710cbea) Co-authored-by: Sam Gross <colesbury@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The `test_imaplib` was taking 40+ minutes in the refleak build bots because the tests waiting on a client `self._setup()` was creating a client that prevented progress until its connection timed out, which scaled with the global timeout. We should set `connect=False` for the tests that don't want `_setup()` to create a client. (cherry picked from commit 710cbea) Co-authored-by: Sam Gross <colesbury@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The `test_imaplib` was taking 40+ minutes in the refleak build bots because the tests waiting on a client `self._setup()` was creating a client that prevented progress until its connection timed out, which scaled with the global timeout. We should set `connect=False` for the tests that don't want `_setup()` to create a client. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The `test_imaplib` was taking 40+ minutes in the refleak build bots because the tests waiting on a client `self._setup()` was creating a client that prevented progress until its connection timed out, which scaled with the global timeout. We should set `connect=False` for the tests that don't want `_setup()` to create a client. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The `test_imaplib` was taking 40+ minutes in the refleak build bots because the tests waiting on a client `self._setup()` was creating a client that prevented progress until its connection timed out, which scaled with the global timeout. We should set `connect=False` for the tests that don't want `_setup()` to create a client. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
The
test_imaplibwas taking 40+ minutes in the refleak build bots because the tests waiting on a clientself._setup()was creating a client that prevented progress until its connection timed out, which scaled with the global timeout.We should set
connect=Falsefor the tests that don't want_setup()to create a client.test_imaplibtakes 40+ minutes in refleaks builds #120048