import random import select import threading import time import unittest from test.support import (cpython_only, requires_subprocess, requires_working_socket) from test.support import threading_helper from test.support.os_helper import TESTFN try: select.poll except AttributeError: raise unittest.SkipTest("select.poll not defined") requires_working_socket(module=True) def find_ready_matching(ready, flag): match = [] for fd, mode in ready: if mode & flag: match.append(fd) return match class PollTests(unittest.TestCase): def test_poll1(self): # Basic functional test of poll object # Create a bunch of pipe and test that poll works with them.
import threading import unittest from unittest import TestCase, skipUnless from test import support as test_support from test.support import hashlib_helper from test.support import socket_helper from test.support import threading_helper import warnings with warnings.catch_warnings(): warnings.simplefilter('ignore', DeprecationWarning) import asynchat import asyncore test_support.requires_working_socket(module=True) HOST = socket_helper.HOST PORT = 0 SUPPORTS_SSL = False if hasattr(poplib, 'POP3_SSL'): import ssl SUPPORTS_SSL = True CERTFILE = os.path.join( os.path.dirname(__file__) or os.curdir, "keycert3.pem") CAFILE = os.path.join( os.path.dirname(__file__) or os.curdir, "pycacert.pem") requires_ssl = skipUnless(SUPPORTS_SSL, 'SSL not supported')
def setUpModule(): support.requires('network') support.requires_working_socket(module=True)