[issue8490] asyncore test suite

Giampaolo Rodola' report at bugs.python.org
Thu Apr 22 18:14:16 CEST 2010


Giampaolo Rodola' <g.rodola at gmail.com> added the comment:

> should be 'listens'
[...]
> should be 'bound'

done

> I'd prefer to see a 'BaseTestAPI' that has no base class, and two 
> TestCase subclasses that use BaseTestAPI as a mixin, one for 
> use_poll=True and one for use_poll=False.

done

> - you don't use use_poll in loop_waiting_for_flag()

whoops! thanks

> - calling time.sleep() in loop_waiting_for_flag() looks wrong to me

time.sleep() in that loop grants that the condition is retried for at least 1 second before failing the test. By removing time.sleep() a test which is supposed to fail will fail almost immediately.

> - test_handle_error should check that the exception state is the 
> expected one (ZeroDivisionError), if at all possible

Good advice, done.

> - in test_set_reuse_addr, if SO_REUSEADDR fails I would suggest skipping the test with self.skip(...),

done

> in test_set_reuse_addr, sock.close() rather than sock.close

whoops =)

> does asyncore support IPv6? test_create_socket checks only AF_INET

I don't think it would worth it. create_socket() is just a thin wrapper around socket.socket(). Actually I wasn't even sure to add that test or not.

> - do you plan to also test UDP? :)

Unfortunately asyncore does not support UDP.
At a first look it would seems so, since create_socket() accepts two parameters, family and *type*:

    def create_socket(self, family, type):
        sock = socket.socket(family, type)

...but actually we can only use SOCK_STREAM, as the API just takes care of wrapping send() and recv() calls, not recvfrom() and sendto().

----------
Added file: http://bugs.python.org/file17047/asyncore.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8490>
_______________________________________


More information about the Python-bugs-list mailing list