/usr/lib/python3/dist-packages/tornado/test/windows_test.py is in python3-tornado 4.5.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | from __future__ import absolute_import, division, print_function
import functools
import os
import socket
import unittest
from tornado.platform.auto import set_close_exec
skipIfNonWindows = unittest.skipIf(os.name != 'nt', 'non-windows platform')
@skipIfNonWindows
class WindowsTest(unittest.TestCase):
def test_set_close_exec(self):
# set_close_exec works with sockets.
s = socket.socket()
self.addCleanup(s.close)
set_close_exec(s.fileno())
# But it doesn't work with pipes.
r, w = os.pipe()
self.addCleanup(functools.partial(os.close, r))
self.addCleanup(functools.partial(os.close, w))
with self.assertRaises(WindowsError) as cm:
set_close_exec(r)
ERROR_INVALID_HANDLE = 6
self.assertEqual(cm.exception.winerror, ERROR_INVALID_HANDLE)
|