Skip to content

Commit 7e6ed0a

Browse files
committed
Fix flaky test.
1 parent 47a3155 commit 7e6ed0a

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/greentest/greentest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ class GenericWaitTestCase(_DelayWaitMixin, TestCase):
591591
# and subject to jitter
592592
_default_delay_max_adj = 1.5
593593

594+
@ignores_leakcheck # waiting checks can be very sensitive to timing
594595
def test_returns_none_after_timeout(self):
595596
result = self._wait_and_check()
596597
# join and wait simply return after timeout expires

src/greentest/test__socket_dns.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,30 @@ def wait(self, timeout):
535535
raise AssertionError('Timeout was not raised')
536536

537537
def cleanup(self):
538-
gevent.get_hub().threadpool.join()
538+
# Depending on timing, this can raise:
539+
# (This suddenly started happening on Apr 6 2016; www.x1000000.com
540+
# is apparently no longer around)
541+
542+
# File "test__socket_dns.py", line 538, in cleanup
543+
# gevent.get_hub().threadpool.join()
544+
# File "/home/travis/build/gevent/gevent/src/gevent/threadpool.py", line 108, in join
545+
# sleep(delay)
546+
# File "/home/travis/build/gevent/gevent/src/gevent/hub.py", line 169, in sleep
547+
# hub.wait(loop.timer(seconds, ref=ref))
548+
# File "/home/travis/build/gevent/gevent/src/gevent/hub.py", line 651, in wait
549+
# result = waiter.get()
550+
# File "/home/travis/build/gevent/gevent/src/gevent/hub.py", line 899, in get
551+
# return self.hub.switch()
552+
# File "/home/travis/build/gevent/gevent/src/greentest/greentest.py", line 520, in switch
553+
# return _original_Hub.switch(self, *args)
554+
# File "/home/travis/build/gevent/gevent/src/gevent/hub.py", line 630, in switch
555+
# return RawGreenlet.switch(self)
556+
# gaierror: [Errno -2] Name or service not known
557+
try:
558+
gevent.get_hub().threadpool.join()
559+
except Exception: # pylint:disable=broad-except
560+
import traceback
561+
traceback.print_exc()
539562

540563

541564
# class TestInterrupted_getaddrinfo(greentest.GenericWaitTestCase):

0 commit comments

Comments
 (0)