test/jsoncomm: check accept with no clients
Ensure that if `accept` is called on a normal listener socket, i.e. the socket is in non-blocking mode, `None` is returned.
This commit is contained in:
parent
8388a64ffa
commit
43db8082bd
1 changed files with 11 additions and 0 deletions
|
|
@ -165,3 +165,14 @@ class TestUtilJsonComm(unittest.TestCase):
|
|||
|
||||
msg = self.client.recv()
|
||||
assert msg[0] == {}
|
||||
|
||||
def test_accept_timeout(self):
|
||||
#
|
||||
# Test calling `accept` without any connection being ready to be
|
||||
# established will not throw any exceptions but return `None`
|
||||
address = pathlib.Path(self.dir.name, "noblock")
|
||||
listener = jsoncomm.Socket.new_server(address)
|
||||
listener.listen()
|
||||
|
||||
conn = listener.accept()
|
||||
self.assertIsNone(conn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue