/usr/lib/python3/dist-packages/twisted/trial/__pycache__
Edit: /usr/lib/python3/dist-packages/twisted/trial/__pycache__/util.cpython-310.pyc (11712B)
o
b0 @ s d Z ddlmZ ddlmZmZ ddlmZ ddlm Z ddl
mZ g dZe
ZdZG d d
d
eZG dd dZe
Zefd
dZdd Zd"ddZdd ZG dd deZdd ZG dd deZdd Zd#dd Zd!S )$a
A collection of utility functions and classes, used internally by Trial.
This code is for Trial's internal use. Do NOT use this code if you are writing
tests. It is subject to change at the Trial maintainer's whim. There is
nothing here in this module for you to use unless you are maintaining Trial.
Any non-Trial Twisted code that uses this module will be shot.
Maintainer: Jonathan Lange
@var DEFAULT_TIMEOUT_DURATION: The default timeout which will be applied to
asynchronous (ie, Deferred-returning) test methods, in seconds.
) randrange)
interfacesutils)Failure)FilePath)FilesystemLock)DEFAULT_TIMEOUT_DURATIONexcInfoOrFailureToExcInfosuppressacquireAttributeg ^@c @ s( e Zd ZdZdddZdefddZdS ) DirtyReactorAggregateErrora7
Passed to L{twisted.trial.itrial.IReporter.addError} when the reactor is
left in an unclean state after a test.
@ivar delayedCalls: The L{DelayedCall
}
objects which weren't cleaned up.
@ivar selectables: The selectables which weren't cleaned up.
Nc C s || _ || _d S N)delayedCallsselectables)selfr r r 4/usr/lib/python3/dist-packages/twisted/trial/util.py__init__2 s
z#DirtyReactorAggregateError.__init__returnc C sP d}| j r|d7 }|dtt| j 7 }| jr&|d7 }|dtt| j7 }|S )zR
Return a multi-line message describing all of the unclean state.
zReactor was unclean.zM
DelayedCalls: (set twisted.internet.base.DelayedCall.debug = True to debug)
z
Selectables:
)r joinmapstrr )r msgr r r __str__6 s z"DirtyReactorAggregateError.__str__r
)__name__
__module____qualname____doc__r r r r r r r r ( s
r c @ s` e Zd ZdZdddZdd Zdd Zd d
Zdd Ze
ed
eddfZdd Zdd Z
dS )_Janitorz
The guy that cleans up after you.
@ivar test: The L{TestCase} to report errors about.
@ivar result: The L{IReporter} to report errors to.
@ivar reactor: The reactor to use. If None, the global reactor
will be used.
Nc C s || _ || _|| _dS )z
@param test: See L{_Janitor.test}.
@param result: See L{_Janitor.result}.
@param reactor: See L{_Janitor.reactor}.
N)testresultreactor)r r r! r" r r r r R s
z_Janitor.__init__c C s0 | }|rt|}| j| jt| dS dS )z
Called by L{unittest.TestCase} after a test to catch any logged errors
or pending L{DelayedCall}s.
FT)
_cleanPendingr r! addErrorr r )r calls aggregater r r postCaseCleanup\ s z_Janitor.postCaseCleanupc C sB | }| }|s|rt||}| j| jt| | dS )a
Called by L{unittest.TestCase} after the last test in a C{TestCase}
subclass. Ensures the reactor is clean by murdering the threadpool,
catching any pending
L{DelayedCall}s, open sockets etc.
N)
_cleanReactorr# r r! r$ r r
_cleanThreads)r r r% r&