Commit 12e5e751 authored by Jason Madden's avatar Jason Madden

Fix some tests.

parent 8eb62985
......@@ -340,9 +340,9 @@ class io(_base.IoMixin, watcher):
# has also gone away.
self._watcher_ref = watcher
@property
def events(self):
return self._events
events = property(
lambda self: self._events,
_base.not_while_active(lambda self, nv: setattr(self, '_events', nv)))
def start(self, callback, *args, **kwargs):
_dbg("Starting IO multiplex watcher for", self.fd,
......@@ -364,7 +364,8 @@ class io(_base.IoMixin, watcher):
self.pass_events = None
self.args = None
watcher = self._watcher_ref
watcher._io_maybe_stop()
if watcher is not None:
watcher._io_maybe_stop()
def close(self):
if self._watcher_ref is not None:
......@@ -382,7 +383,7 @@ class io(_base.IoMixin, watcher):
# ares.pyx depends on this property,
# and test__core uses it too
fd = property(lambda self: self._watcher_ref._fd,
fd = property(lambda self: getattr(self._watcher_ref, '_fd', -1),
lambda self, nv: self._watcher_ref._set_fd(nv))
def _io_maybe_stop(self):
......
......@@ -22,7 +22,7 @@ class TestWatchers(unittest.TestCase):
def test_io(self):
if sys.platform == 'win32':
# libev raises IOError, libuv raises ValueError
Error = (IOError,ValueError)
Error = (IOError, ValueError)
win32 = True
else:
Error = ValueError
......@@ -47,6 +47,7 @@ class TestWatchers(unittest.TestCase):
self.assertEqual(core._events_to_str(io.events), 'WRITE|_IOFDSET')
else:
self.assertEqual(core._events_to_str(io.events), 'WRITE')
io.close()
def test_timer_constructor(self):
with self.assertRaises(ValueError):
......
......@@ -73,10 +73,10 @@ class Test(greentest.TestCase):
loop = core.loop(default=False)
# Watchers aren't reused once all outstanding
# refs go away
# refs go away BUT THEY MUST BE CLOSED
tty_watcher = loop.io(1, core.WRITE)
watcher_handle = tty_watcher._watcher if IS_CFFI else tty_watcher
tty_watcher.close()
del tty_watcher
# XXX: Note there is a cycle in the CFFI code
# from watcher_handle._handle -> watcher_handle.
......@@ -86,7 +86,7 @@ class Test(greentest.TestCase):
tty_watcher = loop.io(1, core.WRITE)
self.assertIsNot(tty_watcher._watcher if IS_CFFI else tty_watcher, watcher_handle)
tty_watcher.close()
loop.destroy()
def reset(watcher, lst):
......
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