MCPcopy Create free account
hub / github.com/twisted/twisted / test_flags

Method test_flags

src/twisted/python/test/test_sendmsg.py:255–274  ·  view source on GitHub ↗

The C{flags} argument to L{sendmsg} is passed on to the underlying C{sendmsg} call, to affect it in whatever way is defined by those flags.

(self)

Source from the content-addressed store, hash-verified

253
254 @skipIf(dontWaitSkip, "MSG_DONTWAIT is only known to work as intended on Linux")
255 def test_flags(self):
256 """
257 The C{flags} argument to L{sendmsg} is passed on to the underlying
258 C{sendmsg} call, to affect it in whatever way is defined by those
259 flags.
260 """
261 # Just exercise one flag with simple, well-known behavior. MSG_DONTWAIT
262 # makes the send a non-blocking call, even if the socket is in blocking
263 # mode. See also test_flags in RecvmsgTests
264 for i in range(8 * 1024):
265 try:
266 sendmsg(self.input, b"x" * 1024, flags=MSG_DONTWAIT)
267 except OSError as e:
268 self.assertEqual(e.args[0], errno.EAGAIN)
269 break
270 else:
271 self.fail(
272 "Failed to fill up the send buffer, "
273 "or maybe send1msg blocked for a while"
274 )
275
276 @inlineCallbacks
277 def test_sendSubProcessFD(self):

Callers

nothing calls this directly

Calls 3

sendmsgFunction · 0.90
assertEqualMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected