%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyc

�
�M!Vc@@s�dZddlmZyddlmZWn!ek
rMddlmZnXddlZddl	Z	ej
d,kZer�ddlZnddl
ZdadadZdadadadZdadadadaiae�ae�adad�Zd�Z d	�Z!d
�Z"d�Z#d�Z$d
�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+gZ,gZ-d�Z.d�Z/e.d��Z0e.d��Z1e.d��Z2e/d��Z3e/d��Z4e/d��Z5d�Z6e/d��Z7e/d��Z8e/d��Z9d �Z:d!�Z;d"�Z<d#�Z=d$�Z>d%�Z?d&�Z@d'�ZAd(�ZBdd)�ZCd*�ZDd+�ZEdS(-sGTesting extensions.

this module is designed to work as a testing-framework-agnostic library,
so that we can continue to support nose and also begin adding new
functionality via py.test.

NOTE:  copied/adapted from SQLAlchemy master for backwards compatibility;
this should be removable when Alembic targets SQLAlchemy 1.0.0


i(tabsolute_import(tSkipTest(tSkippedNic
C@s�|ddddddtdd�|ddddddtdd	�|d
dddddd
dd�|ddddtdd�|ddddddddd�|ddddddd�|ddddddd�|ddddddd�|ddddddd �|d!dddd"d#tdd$�|d%dddddtdd&�|d'dddd(d#tdd)�|d*dddtdddd+�|d,dddtdddd-�|d.dddd/�|d0dd1dd2d#ddd3�dS(4Ns
--log-infotactiontcallbackttypetstringthelps,turn on info logging for <LOG> (multiple OK)s--log-debugs-turn on debug logging for <LOG> (multiple OK)s--dbtappendtdesttdbsBUse prefab database uri. Multiple OK, first one is run by default.s--dbssList available prefab dbss--dburitdburis8Database uri.  Multiple OK, first one is run by default.s--dropfirstt
store_truet	dropfirsts,Drop all tables in the target database firsts--backend-onlytbackend_onlys&Run only tests marked with __backend__s
--mockpooltmockpools0Use mock pool (asserts only one connection used)s--low-connectionstlow_connectionss>Use a low number of distinct connections - i.e. for Oracle TNSs--reversetopt
reversetoptdefaultsTUse a random-ordering set implementation in the ORM (helps reveal dependency issues)s--requirementss3requirements class for testing, overrides setup.cfgs--with-cdecimaltcdecimalsDMonkeypatch the cdecimal library into Python 'decimal' for all testss
--include-tagsInclude tests with tag <tag>s
--exclude-tagsExclude tests with tag <tag>s--serversides"Turn on server side cursors for PGs--mysql-enginetstoretmysql_engines\Use the specified MySQL storage engine for all tables, default is a db-default/InnoDB combo.(t_logt	_list_dbstFalset_requirements_optt_include_tagt_exclude_tagtNone(tmake_option((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt
setup_options9sPcC@sddlm}||_dS(s�Configure required state for a follower.

    This invokes in the parent process and typically includes
    database creation.

    i(t	provisionN(talembic.testingRtFOLLOWER_IDENT(tfollower_identR((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytconfigure_followerjscC@s#itd6td6td6|d<dS(sTStore important configuration we will need to send to a follower.

    This invokes in the parent process after normal config is set up.

    This is necessary as py.test seems to not be using forking, so we
    start with nothing in memory, *but* it isn't running our argparse
    callables, so we have to just copy all of that over.

    tdb_optstinclude_tagstexclude_tagstmemoized_configN(R$R%R&(tdict_((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt!memoize_important_follower_configus
cC@sCtj|dd�tj|dd�tj|dd�dS(sfRestore important configuration needed by a follower.

    This invokes in the follower process.

    R'R$R%R&N(R$tupdateR%R&(R(((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt!restore_important_follower_config�scC@s#tj�atjddg�dS(Ns	setup.cfgstest.cfg(tconfigparsertConfigParsertfile_configtread(((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytread_config�scC@s(|axtD]}|tt�q
WdS(s7things to set up early, before coverage might be setup.N(toptionst
pre_configureR.(topttfn((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt	pre_begin�s
cC@s
|t_dS(N(R1thas_coverage(tvalue((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytset_coverage_flag�scC@snxtD]}|tt�qWddlmamamaddlmamaddl	m
a
tj�dS(s9things to set up later, once we know coverage is running.i(tconfigtwarningst
exclusions(tenginestfixtures(tutilN(tpost_configureR1R.R R9R:R;R<R=t
sqlalchemyR>t
setup_filters(R4((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt
post_begin�s
cC@sytsddlatj�n|jd�rJtj|�jtj�n+|jd�rutj|�jtj�ndS(Nis-infos-debug(tloggingtbasicConfigtendswitht	getLoggertsetLeveltINFOtDEBUG(topt_strR7tparser((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR�s
cG@sQdGHx8ttjd��D]!}d|tjd|�fGHqWtjd�dS(Ns0Available --db options (use --dburi to override)R
s%20s	%si(tsortedR.R1tgettsystexit(targstmacro((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR�scC@st|�dS(N(t_setup_requirements(RJR7RK((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR�scC@stj|jdd��dS(Nt-t_(R&taddtreplace(RJR7RK((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR�scC@stj|jdd��dS(NRSRT(R%RURV(RJR7RK((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR�scC@stj|�|S(N(R2R(R4((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytpre�s
cC@stj|�|S(N(R?R(R4((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytpost�s
cC@s
|adS(N(R1(R3R.((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt_setup_options�scC@s|jrttd<ndS(Ntserver_side_cursors(t
serversidetTrueR$(R1R.((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt_server_side_cursors�s	cC@s)|jr%ddl}|tjd<ndS(Nitdecimal(RRNtmodules(R1R.R((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt_monkeypatch_cdecimal�s	c	C@s-ddlm}ddlm}|jr;t|j�}ng}|jr�xr|jD]d}x[tjd|�D]G}||jd�kr�t	d|��qm|j
|jd|��qmWqTWn|s�|j
|jdd��nxE|D]=}|j|t
|||j�}|js�|j|�q�q�WdS(Ni(R9(Rs[,\s]+R
s:Unknown URI specifier '%s'.  Specify --dbs for known uris.R(R R9RRtlistR
tretsplitR1tRuntimeErrorRRMtsetup_configR$R!t_currenttset_as_current(	R1R.R9Rtdb_urlstdb_tokenR
tdb_urltcfg((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt_engine_uri�s(		
$
	cC@s-|jr)ddlm}|jtd<ndS(Ni(tpoolt	poolclass(RR@Rmt
AssertionPoolR$(R1R.Rm((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt_engine_pools	cC@s |jdd�}t|�dS(Ntsqla_testingtrequirement_cls(RMRR(R1R.Rr((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt
_requirementsscC@s�ddlm}|jdk	r#dS|jd�\}}t|�}x*|jd�dD]}t||�}qXWt||�}|�|_dS(Ni(R9t:t.i(R R9trequirementsRRct
__import__tgetattr(targumentR9tmodnametclsnametmodt	componenttreq_cls((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyRR#scC@s�ddlm}ddlm}ddlm}ddlm}|jr\ddlm	}nddl
m}|j}|j
r�x<|jj�D](}|j}	||	�}
y|
j�}Wntk
r�n:Xx6|D].}|	j|j|j||j����q�W|jjj|�r�y|
jdd	�}Wntk
rDq�Xx?|D]4}|	j|j|j||j�dd	���qLWnxHt|
jd
d��D].}
|	j|j|j|
|j����q�W|jjj|�rAxWt|
jd
ddd	��D]4}
|	j|j|j|
|j�dd	���qWn||d�r�|jr�dd
lm}xJ|
j d�D]6}|	j|j!|j"d|dd|d���qyWq�q�WndS(Ni(R9(tagainst(tschema(R>(tinspect(t	InspectorR�ttest_schematorder_bytforeign_keyt
postgresql(R�t*tname(#R R9talembic.testing.exclusionsRR@R�talembicR>tsqla_08R�tsqlalchemy.engine.reflectionR�tfrom_engineR
tConfigtall_configsR
tget_view_namestNotImplementedErrortexecutet	_DropViewtTabletMetaDataRvtschemastenabled_for_configtreversedtget_table_namest	DropTabletsqla_100tsqlalchemy.dialectsR�t	get_enumstDropEnumTypetENUM(R1R.R9RR�R>R�R�Rktet	inspectort
view_namestvnamettnameR�tenum((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt_prep_testing_database5s\				

 	


 	
cC@s'|jr#ddlm}|�ndS(Ni(trandomize_unitofwork(Rtsqlalchemy.orm.utilR�(R1R.R�((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt_reverse_topologicalts	cC@s&ddlm}t|_||_dS(Ni(R9(R R9R1R.(R3R.R9((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt_post_setup_options{s	cC@sWt|tj�stS|jjd�r,tStjjrOt	|dt�rOtSt
SdS(NRTt__backend__(t
issubclassR=tTestBaseRt__name__t
startswithR9R1RRxR\(tcls((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt
want_class�s
cC@s�|jjd�stS|jdkr)tStr~t|d�r\tj|j	�j
tt�p}t|d�o}|jj
tt�Str�t|d�r�tj|j	�j
tt�Str�t|d�r�|jj
tt�St
SdS(Nttest_t__tags__t_sa_exclusion_extend(R�R�Rt
__module__RR%thasattrR;ttagsR�tinclude_testR&R�R\(R�R4((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytwant_method�s"	

cc@s�t|dt�r�x�t|�D]o}d|j|jj|jjf}t||fid|jj|jjfd6�}t|||�|VqWn|VdS(NR�s%s_%s_%ss%s+%st__only_on__(	RxRt_possible_configs_for_clsR�R
R�tdriverRtsetattr(R�tmoduleRkR�tsubcls((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytgenerate_sub_tests�s"#cC@st|�t|�dS(N(t	_do_skipst
_setup_engine(R�((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytstart_test_class�s
cC@st�dS(N(t_restore_engine(R�((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytstop_test_class�scC@stjj�dS(N(R9Rftreset(((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR��scC@s>t|dd�r:tjd|j�}tjj|�ndS(Nt__engine_options__R1(RxRR<ttesting_engineR�R9Rftpush_engine(R�teng((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR��scC@sdS(N((ttestttest_module_namet
test_classt	test_name((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pytbefore_test�scC@sdS(N((R�((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt
after_test�sc
C@sttjj��}|jrftj|j�}x3t|�D]"}||�r=|j|�q=q=Wnt	|dd�r�tjtj|j
��}x3t|�D]"}||�s�|j|�q�q�Wnt|d�r`tj}x|t|�D]k}xb|jD]W}t	||�}|j|�}|r�|j|�|dk	rQ|j|�nPq�q�Wq�Wnt|d�r�t�}	tj}xVt|�D]H}x?|jD]4}t	||�}|j|�s�|	j|�q�q�Wq�W|j|	�r�|j|	�q�n|S(NR�t__requires__t__prefer_requires__(tsetR9R�R�t__unsupported_on__R;tdb_specRatremoveRxRR>tto_listR�R�RvR�tmatching_config_reasonstextendR�R�RUt
differencetdifference_update(
R�treasonsR�tspect
config_objRvtrequirementtchecktskip_reasonst
non_preferred((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR��sB		
		cC@s�g}t||�}t|dt�rlxBt|d�D].}|�r7td|j|jf��q7q7Wn|s�t|dt�r�d|j|jf}n;d|jdjd�tjj	�D��dj|�f}t|��n�t
|d�rit�}tj
tj|j��}x*|D]"}||�s!|j|�q!q!W|j|�ri|j|�qintj|kr�t|j�|�ndS(	Nt__skip_if__s'%s' skipped by %sR�s('%s' unsupported for implementation '%s's.'%s' unsupported on any DB implementation %s%ss, cs@sJ|]@}d|jjdjd�|jjjD��|jjfVqdS(s'%s(%s)+%s'Rucs@s|]}t|�VqdS(N(tstr(t.0tdig((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pys	<genexpr>sN(R
R�tjointdialecttserver_version_infoR�(R�R�((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pys	<genexpr>st__prefer_backends__(R�RxRRR�R�R�R9R�R�R�R�R;R�R>R�R�RUR�R�Rft
_setup_configtpop(R�R�R�tctmsgR�R�R�((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR��s8	 	
cC@stjj|�dS(N(R9Rftpush(R�tctx((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyR�+s(ii(Ft__doc__t
__future__RtnoseRtImportErrort_pytest.runnerRRNRbtversion_infotpy3kR,R-RR=R<RR;R:t
assertionsRvR9R>R.RCR$R�R%R&R1RR#R)R+R0R5R8RBRRRRRR2R?RWRXRYR]R`RlRpRsRRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sS/opt/alt/python27/lib/python2.7/site-packages/alembic/testing/plugin/plugin_base.pyt<module>s�
			1														 	?									+	,

Zerion Mini Shell 1.0