✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ beluga.o2switch.net ​🇻​♯➤ 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 185.154.139.77 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.84
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /opt/alt/python38/lib64/python3.8/test/test_asyncio//test_windows_utils.py
"""Tests for window_utils"""

import sys
import unittest
import warnings

if sys.platform != 'win32':
    raise unittest.SkipTest('Windows only')

import _overlapped
import _winapi

import asyncio
from asyncio import windows_utils
from test import support


def tearDownModule():
    asyncio.set_event_loop_policy(None)


class PipeTests(unittest.TestCase):

    def test_pipe_overlapped(self):
        h1, h2 = windows_utils.pipe(overlapped=(True, True))
        try:
            ov1 = _overlapped.Overlapped()
            self.assertFalse(ov1.pending)
            self.assertEqual(ov1.error, 0)

            ov1.ReadFile(h1, 100)
            self.assertTrue(ov1.pending)
            self.assertEqual(ov1.error, _winapi.ERROR_IO_PENDING)
            ERROR_IO_INCOMPLETE = 996
            try:
                ov1.getresult()
            except OSError as e:
                self.assertEqual(e.winerror, ERROR_IO_INCOMPLETE)
            else:
                raise RuntimeError('expected ERROR_IO_INCOMPLETE')

            ov2 = _overlapped.Overlapped()
            self.assertFalse(ov2.pending)
            self.assertEqual(ov2.error, 0)

            ov2.WriteFile(h2, b"hello")
            self.assertIn(ov2.error, {0, _winapi.ERROR_IO_PENDING})

            res = _winapi.WaitForMultipleObjects([ov2.event], False, 100)
            self.assertEqual(res, _winapi.WAIT_OBJECT_0)

            self.assertFalse(ov1.pending)
            self.assertEqual(ov1.error, ERROR_IO_INCOMPLETE)
            self.assertFalse(ov2.pending)
            self.assertIn(ov2.error, {0, _winapi.ERROR_IO_PENDING})
            self.assertEqual(ov1.getresult(), b"hello")
        finally:
            _winapi.CloseHandle(h1)
            _winapi.CloseHandle(h2)

    def test_pipe_handle(self):
        h, _ = windows_utils.pipe(overlapped=(True, True))
        _winapi.CloseHandle(_)
        p = windows_utils.PipeHandle(h)
        self.assertEqual(p.fileno(), h)
        self.assertEqual(p.handle, h)

        # check garbage collection of p closes handle
        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", "",  ResourceWarning)
            del p
            support.gc_collect()
        try:
            _winapi.CloseHandle(h)
        except OSError as e:
            self.assertEqual(e.winerror, 6)     # ERROR_INVALID_HANDLE
        else:
            raise RuntimeError('expected ERROR_INVALID_HANDLE')


class PopenTests(unittest.TestCase):

    def test_popen(self):
        command = r"""if 1:
            import sys
            s = sys.stdin.readline()
            sys.stdout.write(s.upper())
            sys.stderr.write('stderr')
            """
        msg = b"blah\n"

        p = windows_utils.Popen([sys.executable, '-c', command],
                                stdin=windows_utils.PIPE,
                                stdout=windows_utils.PIPE,
                                stderr=windows_utils.PIPE)

        for f in [p.stdin, p.stdout, p.stderr]:
            self.assertIsInstance(f, windows_utils.PipeHandle)

        ovin = _overlapped.Overlapped()
        ovout = _overlapped.Overlapped()
        overr = _overlapped.Overlapped()

        ovin.WriteFile(p.stdin.handle, msg)
        ovout.ReadFile(p.stdout.handle, 100)
        overr.ReadFile(p.stderr.handle, 100)

        events = [ovin.event, ovout.event, overr.event]
        # Super-long timeout for slow buildbots.
        res = _winapi.WaitForMultipleObjects(events, True, 10000)
        self.assertEqual(res, _winapi.WAIT_OBJECT_0)
        self.assertFalse(ovout.pending)
        self.assertFalse(overr.pending)
        self.assertFalse(ovin.pending)

        self.assertEqual(ovin.getresult(), len(msg))
        out = ovout.getresult().rstrip()
        err = overr.getresult().rstrip()

        self.assertGreater(len(out), 0)
        self.assertGreater(len(err), 0)
        # allow for partial reads...
        self.assertTrue(msg.upper().rstrip().startswith(out))
        self.assertTrue(b"stderr".startswith(err))

        # The context manager calls wait() and closes resources
        with p:
            pass


if __name__ == '__main__':
    unittest.main()


Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
25 Oct 2024 11.54 AM
root / linksafe
0755
__pycache__
--
25 Oct 2024 11.54 AM
root / linksafe
0755
__init__.py
0.238 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
__main__.py
0.057 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
echo.py
0.145 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
echo2.py
0.12 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
echo3.py
0.27 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
functional.py
7.466 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_asyncio_waitfor.py
1.453 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_base_events.py
78.138 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_buffered_proto.py
2.282 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_context.py
0.996 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_events.py
99.684 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_futures.py
26.424 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_futures2.py
0.678 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_locks.py
33.671 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_pep492.py
6.045 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_proactor_events.py
35.038 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_protocols.py
1.996 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_queues.py
21.159 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_runners.py
5.057 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_selector_events.py
47.165 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_sendfile.py
19.669 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_server.py
3.928 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_sock_lowlevel.py
11.845 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_sslproto.py
25.781 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_streams.py
36.214 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_subprocess.py
25.331 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_tasks.py
107.167 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_transports.py
3.534 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_unix_events.py
66.231 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_windows_events.py
10.5 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
test_windows_utils.py
4.065 KB
6 Sep 2024 8.41 PM
root / linksafe
0644
utils.py
16.829 KB
6 Sep 2024 8.41 PM
root / linksafe
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF