%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/227033/root/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/
Upload File :
Create Path :
Current File : //proc/227033/root/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyc

�
��4]c@@ssddlmZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZd
efd��YZ
e
�Zd�Ze	d
��Ze	d��Ze	d��Ze	d��Zdd�Zdefd��YZddd�Zddd�Zdd�Zdefd��YZdefd��YZeed�ZdS(i(tabsolute_importNi(tconfig(tuses_deprecated(t	decoratori(tevent(tpooltConnectionKillercB@s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Ze�d
��Z
e�d��Zd�ZRS(
cC@s.tj�|_tj�|_t�|_dS(N(tweakreftWeakKeyDictionaryt
proxy_refsttesting_enginestsettconns(tself((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt__init__scC@st|j|<dS(N(tTrueR
(R
tengine((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt
add_enginescC@s|jj||f�dS(N(Rtadd(R
t
dbapi_connt
con_record((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytconnectscC@st|j|<dS(N(RR	(R
t	dbapi_conRt	con_proxy((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytcheckout!scC@s|jj||f�dS(N(Rtdiscard(R
RRt	exception((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt
invalidate$scC@s6y|�Wn$tk
r1}tjd|�nXdS(Ns5testing_reaper couldn't rollback/close connection: %s(t	Exceptiontwarningstwarn(R
tfnte((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt_safe's
cC@sFx?t|j�D].}|dk	r|jr|j|j�qqWdS(N(tlistR	tNonetis_validR!trollback(R
trec((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytrollback_all/scC@sFx?t|j�D].}|dk	r|jr|j|j�qqWdS(N(R"R	R#R$R!t_close(R
R&((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt	close_all4scC@sIxBt|j�D]1\}}|jdkr1qn|j|j�qWdS(N(R"Rt
connectionR#R!R%(R
tconnR&((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt_after_test_ctx9scC@s'tjjr|j�n
|j�dS(N(Rtoptionstlow_connectionst_stop_test_ctx_minimalt_stop_test_ctx_aggressive(R
((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt_stop_test_ctxHs
cC@sP|j�t�|_x3t|j�D]"}|tjk	r&|j�q&q&WdS(N(R)RRR"R
Rtdbtdispose(R
R&((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR/Ns

cC@sw|j�x6t|j�D]%\}}|j|j�d|_qWt�|_x!t|j�D]}|j	�q_WdS(N(
R)R"RR!tcloseR#R*RR
R3(R
R+R&((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR0Xs

cC@s0x)|jD]}|jr
ts(t�q
q
WdS(N(R	R$tFalsetAssertionError(R
R&((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytassert_all_closedcs	(t__name__t
__module__RRRRRR!R'R)R,R1RR/R0R7(((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyRs										
cC@s�tj�t|d�r&|j�ntjjjsqddlm	}|j
ddt��|j|�WdQXn
|j|�dS(NR4i(t
assertionssCan't sort tablestassert_(
ttesting_reaperR)thasattrR4RR2tdialecttsupports_altertR:texpect_warningsR5tdrop_all(tmetadatatbindR:((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytdrop_all_tablesls

cO@s#z|||�Wdtj�XdS(N(R<R7(Rtargstkw((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytassert_conns_closedzscO@s#z|||�Wdtj�XdS(sBDecorator that rolls back all open connections after fn execution.N(R<R'(RRFRG((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytrollback_open_connections�scO@stj�|||�dS(s:Decorator that closes all connections before fn execution.N(R<R)(RRFRG((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytclose_first�s
cO@s#z|||�Wdtj�XdS(s9Decorator that closes all connections after fn execution.N(R<R)(RRFRG((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytclose_open_connections�scc@s�ddlj}xk|jD]`}|r7||kr7qnt||d�}|snttd|�j|�}n|j�VqWdS(Nissqlalchemy.databases.%s(tsqlalchemy.databasest	databasest__all__tgetattrR#t
__import__R>(texcludetdtnametmod((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytall_dialects�stReconnectFixturecB@sAeZd�Zd�Zd�Zd�Zed�Zd�ZRS(cC@s||_g|_t|_dS(N(tdbapitconnectionsR5t
is_stopped(R
RW((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR�s		cC@st|j|�S(N(RORW(R
tkey((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt__getattr__�scO@st|jj||�}|jr\|j|j�|j�}|jd�tsptd��n|j	j
|�|SdS(Nsselect 1s%simulated connect failure didn't work(RWRRYR!R4tcursortexecuteR5R6RXtappend(R
RFtkwargsR+tcurs((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR�s	
cC@s6y|�Wn$tk
r1}tjd|�nXdS(Ns.ReconnectFixture couldn't close connection: %s(RRR(R
RR ((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR!�s
cC@s@||_x't|j�D]}|j|j�qWg|_dS(N(RYR"RXR!R4(R
tstoptc((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytshutdown�s	cC@s
t|_dS(N(R5RY(R
((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytrestart�s(	R8R9RR[RR!R5RcRd(((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyRV�s				c@s�|ptjj}tjjj}|s0i}nt|�|d<t||���j���fd�}�jjj�_	�jjj
�_|�_�S(Ntmodulec@s*�jjj�t�jj_��dS(N(R>RWRcR5RY((t_disposeR(sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR3�s(RR2turlR>RWRVttesting_engineR3Rct
test_shutdownRdttest_restart(RgR-RWR3((RfRsM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytreconnecting_engine�s			cC@s�ddlm}ddlm}|s/t}n|jdt�}|pPtjj}||�}|dkr�tjdks�|j
tjjj
kr�tj}q�i}nFtjdk	r�|j
tjjj
kr�tjj�}|j
|�n|||�}t|_t|jtj�r5d|j_d|j_n|r�tj|jdtj�tj|jdtj�tj|jdtj�tj|�n|S(	sBProduce an engine configured by --options with optional overrides.i(t
create_engine(tmake_urlt
use_reaperRRRN(t
sqlalchemyRltsqlalchemy.engine.urlRmRtpopRR2RgR#t
drivernametdb_optstcopytupdatet_has_eventst
isinstanceRt	QueuePoolt_timeoutt
_max_overflowRtlistenR<RRRR(RgR-RlRmRntdefault_optR((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyRh�s2	'	'	c@s�ddlm}|s%tjj}ng��fd�}�fd�}�fd�}||dddd	|��t�d�s�t���_|�_|�_	�S(
s'Provides a mocking engine based on the current testing.db.

    This is normally used to test DDL generation flow as emitted
    by an Engine.

    It should not be used in other cases, as assert_compile() and
    assert_sql_execution() are much better choices with fewer
    moving parts.

    i(Rlc@s�j|�dS(N(R^(tsqltaRG(tbuffer(sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytexecutor'sc@sJg�D]!}tjddt|��^q}||ksFt|��dS(Ns[\n\t]R@(tretsubtstrR6(tstmtststrecv(R(sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt
assert_sql*s.c@s)�j�dj�fd��jD��S(Ns
c3@s'|]}t|jd���VqdS(R>N(R�tcompile(t.0R�(RR(sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pys	<genexpr>0s(R>tjointmock((R(RRsM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt	print_sql.s	s://tstrategyR�R�(
RoRlRR2RSR=R6R�R�R�(tdialect_nameRlR�R�R�((RRsM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytmock_engines			tDBAPIProxyCursorcB@s5eZdZd�Zdd�Zd�Zd�ZRS(suProxy a DBAPI cursor.

    Tests can provide subclasses of this to intercept
    DBAPI-level cursor operations.

    cO@s+||_||_|j||�|_dS(N(RR*R\(R
RR+RFR_((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyRDs		cK@s3|r|jj|||�S|jj||�SdS(N(R\R](R
tstmtt
parametersRG((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR]IscK@s|jj|||�S(N(R\texecutemany(R
R�tparamsRG((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR�OscC@st|j|�S(N(ROR\(R
RZ((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR[RsN(R8R9t__doc__RR#R]R�R[(((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR�<s
		tDBAPIProxyConnectioncB@s2eZdZd�Zd�Zd�Zd�ZRS(s}Proxy a DBAPI connection.

    Tests can provide subclasses of this to intercept
    DBAPI-level connection operations.

    cC@s/|jj�|_|_||_||_dS(N(Rt_creatorR+t_sqla_unwrapRt
cursor_cls(R
RR�((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR^s	cO@s|j|j|j||�S(N(R�RR+(R
RFR_((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR\cscC@s|jj�dS(N(R+R4(R
((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR4fscC@st|j|�S(N(ROR+(R
RZ((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR[is(R8R9R�RR\R4R[(((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyR�Vs
			c@s&��fd�}tdi|d6�S(sIProduce an engine that provides proxy hooks for
    common methods.

    c@s�tj��S(N(RR2((tconn_clsR�(sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt	mock_connusR-tcreator(Rh(R�R�R�((R�R�sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pytproxying_enginems(t
__future__RR�RRR@RRtutilRRRtobjectRR<RERHRIRJRKR#RURVRkRhR�R�R�R�(((sM/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/engines.pyt<module>s.T		
	.&(

Zerion Mini Shell 1.0