| Server IP : 61.19.30.66 / Your IP : 216.73.216.15 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python2.7/dist-packages/twisted/internet/test/ |
Upload File : |
ó
±ZOc @ sÉ d Z e Z d d l Z d d l m Z d d l m Z m Z d d l m
Z
d d l m Z m
Z
d d l m Z d d l m Z e
j ƒ r™ d Z n d d l m Z d
d d „ ƒ YZ d
g Z d S(
s/
Tests for implementations of L{IReactorTime}.
iÿÿÿÿN( t TimeoutError( t TestCaset SkipTest( t platform( t namedAnyt fullyQualifiedName( t log( t Failure( t processt ReactorBuilderc B sê e Z d Z d g Z e j ƒ r@ e j d d d d d g ƒ nK e j d d d d
g ƒ e j ƒ ru e j d ƒ n e j d d
d g ƒ d Z
d Z d Z i Z
d „ Z d „ Z d „ Z d „ Z d d „ Z d „ Z e e ƒ Z RS( s¬
L{TestCase} mixin which provides a reactor-creation API. This mixin
defines C{setUp} and C{tearDown}, so mix it in before L{TestCase} or call
its methods from the overridden ones in the subclass.
@cvar skippedReactors: A dict mapping FQPN strings of reactors for
which the tests defined by this class will be skipped to strings
giving the skip message.
@cvar requiredInterfaces: A C{list} of interfaces which the reactor must
provide or these tests will be skipped. The default, C{None}, means
that no interfaces are required.
@ivar reactorFactory: A no-argument callable which returns the reactor to
use for testing.
@ivar originalHandler: The SIGCHLD handler which was installed when setUp
ran and which will be re-installed when tearDown runs.
@ivar _reactors: A list of FQPN strings giving the reactors for which
TestCases will be created.
s, twisted.internet.selectreactor.SelectReactors, twisted.internet.gireactor.PortableGIReactors0 twisted.internet.gtk3reactor.PortableGtk3Reactors/ twisted.internet.gtk2reactor.PortableGtkReactors/ twisted.internet.win32eventreactor.Win32Reactors0 twisted.internet.iocpreactor.reactor.IOCPReactors$ twisted.internet.gireactor.GIReactors( twisted.internet.gtk3reactor.Gtk3Reactors* twisted.internet.glib2reactor.Glib2Reactors( twisted.internet.gtk2reactor.Gtk2Reactors$ twisted.internet.cfreactor.CFReactors( twisted.internet.pollreactor.PollReactors* twisted.internet.epollreactor.EPollReactors( twisted.internet.kqreactor.KQueueReactorc C s. t j ƒ s* t j t j t j ƒ | _ n d S( s›
Clear the SIGCHLD handler, if there is one, to ensure an environment
like the one which exists prior to a call to L{reactor.run}.
N( R t isWindowst signalt SIGCHLDt SIG_DFLt originalHandler( t self( ( sG /usr/lib/python2.7/dist-packages/twisted/internet/test/reactormixins.pyt setUpU s c C sl | j d k r( t j t j | j ƒ n t d k rh x1 t j rd t j d t j f ƒ t j ƒ q7 Wn d S( s|
Restore the original SIGCHLD handler and reap processes as long as
there seem to be any remaining.
s1 ReactorBuilder.tearDown reaping some processes %rN( R t NoneR R R t reapProcessHandlersR t msgt reapAllProcesses( R ( ( sG /usr/lib/python2.7/dist-packages/twisted/internet/test/reactormixins.pyt tearDown^ s c C s• | j ƒ t | d d ƒ d k r` x+ | j D] } | j | ƒ | j d ƒ q, W| j j ƒ n | j ƒ | j ƒ } x | D] } | j ƒ q} Wd S( s
Clean up any resources which may have been allocated for the given
reactor by its creation or by a test which used it.
t _internalReadersN(
t _uninstallHandlert getattrR R t removeReadert connectionLostt cleart
disconnectAllt getDelayedCallst cancel( R t reactort readert callst c( ( sG /usr/lib/python2.7/dist-packages/twisted/internet/test/reactormixins.pyt unbuildReactorm s
c sI y$ d d l m } d d l m } Wn t k
r7 n. Xt | | ƒ re | j | k re t d ƒ ‚ n y | j ƒ ‰ Wn6 t j d d ƒ | j ƒ t t ƒ j
ƒ ƒ ‚ n… X| j d k r2t ‡ f d † | j ƒ } | r2| j ˆ ƒ t d t ˆ j ƒ d j g | D] } t | ƒ ^ q
ƒ f ƒ ‚ q2n | j | j ˆ ƒ ˆ S(
sK
Create and return a reactor using C{self.reactorFactory}.
iÿÿÿÿ( t CFReactor( R su CFReactor uses APIs which manipulate global state, so it's not safe to run its own reactor-builder tests under itselfs Failed to install reactorc s | j ˆ ƒ S( N( t
providedBy( t required( R ( sG /usr/lib/python2.7/dist-packages/twisted/internet/test/reactormixins.pyt <lambda>¬ s s %s does not provide %st ,N( t twisted.internet.cfreactorR$ t twisted.internetR t ImportErrort
isinstancet reactorFactoryR R t errR t flushLoggedErrorsR t getErrorMessaget requiredInterfacest filterR# R t __class__t joint
addCleanup( R R$ t
globalReactort missingt x( ( R sG /usr/lib/python2.7/dist-packages/twisted/internet/test/reactormixins.pyt buildReactor s4
5c sm | d k r | j ƒ } n g ‰ ‡ ‡ f d † } ˆ j | | ƒ ˆ j ƒ ˆ ri t d | f ƒ ‚ n d S( sº
Run the reactor for at most the given amount of time.
@param reactor: The reactor to run.
@type timeout: C{int} or C{float}
@param timeout: The maximum amount of time, specified in seconds, to
allow the reactor to run. If the reactor is still running after
this much time has elapsed, it will be stopped and an exception
raised. If C{None}, the default test method timeout imposed by
Trial will be used. This depends on the L{IReactorTime}
implementation of C{reactor} for correct operation.
@raise TimeoutError: If the reactor is still running after C{timeout}
seconds.
c s ˆ j d ƒ ˆ j ƒ d S( N( t appendR t stop( ( t timedOutR ( sG /usr/lib/python2.7/dist-packages/twisted/internet/test/reactormixins.pyR; Ì s
s&