/opt/imh-python/lib/python3.9/site-packages/zmq/tests
NameSizeModeActions
asyncio/-0755rm
__pycache__/-0755rm
conftest.py3660644editdlrm
test_auth.py207120644editdlrm
test_cffi_backend.py94810644editdlrm
test_constants.py45700644editdlrm
test_context.py120270644editdlrm
test_cython.py10480644editdlrm
test_decorators.py94950644editdlrm
test_device.py61690644editdlrm
test_draft.py14710644editdlrm
test_error.py12600644editdlrm
test_etc.py5250644editdlrm
test_future.py111590644editdlrm
test_imports.py18050644editdlrm
test_includes.py10130644editdlrm
test_ioloop.py39650644editdlrm
test_log.py66970644editdlrm
test_message.py110910644editdlrm
test_monitor.py30440644editdlrm
test_monqueue.py82230644editdlrm
test_multipart.py9440644editdlrm
test_pair.py12600644editdlrm
test_poll.py72600644editdlrm
test_proxy_steerable.py39220644editdlrm
test_pubsub.py10890644editdlrm
test_reqrep.py18410644editdlrm
test_retry_eintr.py29600644editdlrm
test_security.py81410644editdlrm
test_socket.py216530644editdlrm
test_ssh.py2340644editdlrm
test_version.py13340644editdlrm
test_win32_shim.py17410644editdlrm
test_z85.py22320644editdlrm
test_zmqstream.py24390644editdlrm
__init__.py63820644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/zmq/tests/test_win32_shim.py (1741B)
from __future__ import print_function import os import time import sys from functools import wraps from pytest import mark from zmq.tests import BaseZMQTestCase from zmq.utils.win32 import allow_interrupt def count_calls(f): @wraps(f) def _(*args, **kwds): try: return f(*args, **kwds) finally: _.__calls__ += 1 _.__calls__ = 0 return _ @mark.new_console class TestWindowsConsoleControlHandler(BaseZMQTestCase): @mark.new_console @mark.skipif( not sys.platform.startswith('win'), reason='Windows only test') def test_handler(self): @count_calls def interrupt_polling(): print('Caught CTRL-C!') from ctypes import windll from ctypes.wintypes import BOOL, DWORD kernel32 = windll.LoadLibrary('kernel32') # GenerateConsoleCtrlEvent = kernel32.GenerateConsoleCtrlEvent GenerateConsoleCtrlEvent.argtypes = (DWORD, DWORD) GenerateConsoleCtrlEvent.restype = BOOL # Simulate CTRL-C event while handler is active. try: with allow_interrupt(interrupt_polling) as context: result = GenerateConsoleCtrlEvent(0, 0) # Sleep so that we give time to the handler to # capture the Ctrl-C event. time.sleep(0.5) except KeyboardInterrupt: pass else: if result == 0: raise WindowsError() else: self.fail('Expecting `KeyboardInterrupt` exception!') # Make sure our handler was called. self.assertEqual(interrupt_polling.__calls__, 1)