Commit 7c6b53f0 authored by ento's avatar ento

Pylint: Fix or disable used-before-assignment

parent 150ba0d2
......@@ -66,7 +66,7 @@ __all__ = [
]
try:
ResourceWarning
ResourceWarning # pylint:disable=used-before-assignment
except NameError:
class ResourceWarning(Warning):
"Python 2 fallback"
......
......@@ -47,7 +47,7 @@ __imports__ = copy_globals(__ssl__, globals(),
dunder_names_to_keep=())
try:
_delegate_methods
_delegate_methods # pylint:disable=used-before-assignment
except NameError: # PyPy doesn't expose this detail
_delegate_methods = ('recv', 'recvfrom', 'recv_into', 'recvfrom_into', 'send', 'sendto')
......
......@@ -280,7 +280,7 @@ else:
from gevent.os import fork_and_watch
try:
BrokenPipeError
BrokenPipeError # pylint:disable=used-before-assignment
except NameError: # Python 2
class BrokenPipeError(Exception):
"Never raised, never caught."
......
......@@ -269,12 +269,14 @@ class TestAsyncResultCrossThread(greentest.TestCase):
gevent.get_hub().destroy(destroy_loop=True)
thread = Thread()
glet = None
try:
glet = gevent.spawn(thread.start)
result = thread.async_result.wait(self.BG_WAIT_DELAY)
finally:
thread.join(DELAY * 15)
glet.join(DELAY)
if glet is not None:
glet.join(DELAY)
self._check_result(result)
@greentest.ignores_leakcheck
......
......@@ -25,7 +25,7 @@ import gevent.testing as greentest
from gevent.testing import sysinfo
try:
ResourceWarning
ResourceWarning # pylint:disable=used-before-assignment
except NameError:
class ResourceWarning(Warning):
"Python 2 fallback"
......
......@@ -32,6 +32,7 @@ class SelectorTestMixin(object):
def _check_selector(self, sel):
server, client = socket.socketpair()
glet = None
try:
sel.register(server, selectors.EVENT_READ, self.read_from_ready_socket_and_reply)
glet = gevent.spawn(self.run_selector_once, sel)
......@@ -43,8 +44,9 @@ class SelectorTestMixin(object):
sel.close()
server.close()
client.close()
glet.join(10)
self.assertTrue(glet.ready())
if glet is not None:
glet.join(10)
self.assertTrue(glet is not None and glet.ready())
class GeventSelectorTest(SelectorTestMixin,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment