Commit 7c6b53f0 authored by ento's avatar ento

Pylint: Fix or disable used-before-assignment

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