Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test_ioloop.py #516

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pyftpdlib/test/test_ioloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class PollIOLoopTestCase(unittest.TestCase, BaseIOLoopTestCase):
@unittest.skipIf(sys.version_info[:2] == (3, 2), "")
def test_eintr_on_poll(self):
# EINTR is supposed to be ignored
with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m:
with mock.patch(self.poller_mock) as m:
if not PY3:
m.return_value.poll.side_effect = select.error
m.return_value.poll.side_effect.errno = errno.EINTR
Expand All @@ -200,7 +200,7 @@ def test_eintr_on_poll(self):
s.poll(0)
assert m.called
# ...but just that
with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m:
with mock.patch(self.poller_mock) as m:
if not PY3:
m.return_value.poll.side_effect = select.error
m.return_value.poll.side_effect.errno = errno.EBADF
Expand All @@ -212,34 +212,34 @@ def test_eintr_on_poll(self):

def test_eexist_on_register(self):
# EEXIST is supposed to be ignored
with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m:
with mock.patch(self.poller_mock) as m:
m.return_value.register.side_effect = \
EnvironmentError(errno.EEXIST, "")
s, rd, wr = self.test_register()
# ...but just that
with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m:
with mock.patch(self.poller_mock) as m:
m.return_value.register.side_effect = \
EnvironmentError(errno.EBADF, "")
self.assertRaises(EnvironmentError, self.test_register)

def test_enoent_ebadf_on_unregister(self):
# ENOENT and EBADF are supposed to be ignored
for errnum in (errno.EBADF, errno.ENOENT):
with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m:
with mock.patch(self.poller_mock) as m:
m.return_value.unregister.side_effect = \
EnvironmentError(errnum, "")
s, rd, wr = self.test_register()
s.unregister(rd)
# ...but just those
with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m:
with mock.patch(self.poller_mock) as m:
m.return_value.unregister.side_effect = \
EnvironmentError(errno.EEXIST, "")
s, rd, wr = self.test_register()
self.assertRaises(EnvironmentError, s.unregister, rd)

def test_enoent_on_modify(self):
# ENOENT is supposed to be ignored
with mock.patch(self.poller_mock, return_vaue=mock.Mock()) as m:
with mock.patch(self.poller_mock) as m:
m.return_value.modify.side_effect = \
OSError(errno.ENOENT, "")
s, rd, wr = self.test_register()
Expand Down