� ��4]c@@s~dZddlmZddlZddlZejd-kZerRddlZn ddlZda da da da dadadZdadadadadae�ae�adad�Zd�Zd�Zd�Zd �Zd �Zd �Z da!d �Z"d �Z#d�Z$d�Z%d�Z&d�Z'd�Z(gZ)gZ*d�Z+d�Z,e+d��Z-e+d��Z.e+d��Z/e,d��Z0e,d��Z1e,d��Z2d�Z3e,d��Z4e,d��Z5e,d��Z6e,d��Z7d �Z8d!�Z9d"�Z:d#�Z;d$�Z<d%�Z=d&�Z>d'�Z?d(�Z@d)�ZAdeBd*�ZCd+�ZDd,�ZEdS(.s�Testing extensions. this module is designed to work as a testing-framework-agnostic library, created so that multiple test frameworks can be supported at once (mostly so that we can migrate to new ones). The current target is py.test. i(tabsolute_importNic C@s8|ddddddtdd�|ddddddtdd �|d dd ddd d dd�|ddddtdd�|ddd ddd ddd�|dddd ddd�|dddd ddd�|dddd ddd�|ddddd �|d!ddd d"dd#�|d$ddd d%dd&�|d'ddd d(d)tdd*�|d+dddddtdd,�|d-ddd d.d)tdd/�|d0dddtdddd1�|d2dddtdddd3�|d4ddd d5d)tdd6�|d7ddd d8d)tdd9�dS(:Ns --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--dbstzeroarg_callbacksList 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__ or __sparse_backend__s --nomemorytnomemorys Don't run memory profiling testss--postgresql-templatedbs^name of template database to use for PostgreSQL CREATE DATABASE (defaults to current database)s--low-connectionstlow_connectionss>Use a low number of distinct connections - i.e. for Oracle TNSs--write-identst write_identssCwrite out generated follower idents to <file>, when -n<num> is useds --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--write-profilestwrite_profiless$Write/update failing profiling data.s--force-write-profilestforce_write_profiless,Unconditionally write/update profiling data.(t_logt _list_dbstFalset_requirements_optt _include_tagt _exclude_tag(t make_option((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt setup_options2s�cC@sddlm}||_dS(s�Configure required state for a follower. This invokes in the parent process and typically includes database creation. i(t provisionN(tsqlalchemy.testingRtFOLLOWER_IDENT(tfollower_identR((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pytconfigure_follower�scC@sitd6td6|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. t include_tagst exclude_tagstmemoized_configN(R#R$(tdict_((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt!memoize_important_follower_config�s cC@s.tj|dd�tj|dd�dS(sfRestore important configuration needed by a follower. This invokes in the follower process. R%R#R$N(R#tupdateR$(R&((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt!restore_important_follower_config�scC@s#tj�atjddg�dS(Ns setup.cfgstest.cfg(t configparsert ConfigParsert file_configtread(((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt read_config�s cC@s(|axtD]}|tt�q WdS(s7things to set up early, before coverage might be setup.N(toptionst pre_configureR,(topttfn((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt pre_begin�s cC@s |t_dS(N(R/t has_coverage(tvalue((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pytset_coverage_flag�scC@s |adS(N(t_skip_test_exception(texc((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt set_skip_test�scC@s�xtD]}|tt�qWddlmaddlmamamaddlm a m a m a ddlm a ddlm a t j�dS(s9things to set up later, once we know coverage is running.i(ttesting(tfixturestenginest exclusions(t assertionstwarningst profiling(tconfig(tutilN(tpost_configureR/R,t sqlalchemyR:RR;R<R=R>R?R@RARBt setup_filters(R2((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt post_begin�s cC@sytsddlatj�n|jd�rJtj|�jtj�n+|jd�rutj|�jtj�ndS(Nis-infos-debug(tloggingt basicConfigtendswitht getLoggertsetLeveltINFOtDEBUG(topt_strR5tparser((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyRs  cG@sQdGHx8ttjd��D]!}d|tjd|�fGHqWtjd�dS(Ns0Available --db options (use --dburi to override)Rs%20s %si(tsortedR,R/tgettsystexit(targstmacro((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyRscC@st|�dS(N(t_setup_requirements(RNR5RO((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyRscC@stj|jdd��dS(Nt-t_(R$taddtreplace(RNR5RO((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyRscC@stj|jdd��dS(NRWRX(R#RYRZ(RNR5RO((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyR scC@stj|�|S(N(R0R(R2((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pytpre(s cC@stj|�|S(N(RCR(R2((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pytpost-s cC@s |adS(N(R/(R1R,((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt_setup_options2scC@s|jrtjd�ndS(Ntmemory_intensive(RR$RY(R1R,((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt _set_nomemory8s cC@s)|jr%ddl}|tjd<ndS(Nitdecimal(RRRtmodules(R/R,R((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt_monkeypatch_cdecimal>s  cC@sddlm}t|_dS(Ni(RA(RRAR7(R/R,RA((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt_init_skiptestFsc C@s�ddlm}ddlm}ddlm}|jrKt|j�}ng}|jr�xr|jD]d}x[tj d|�D]G}||j d�kr�t d|��q}|j |j d|��q}WqdWn|s�|j |j dd��nd|_x�|D]�}|jrS|jrSt|jd ��#} | j|jd |d �WdQXn|j||||j�} |js| j| |�qqWdS( Ni(RA(R:(Rs[,\s]+Rs:Unknown URI specifier '%s'. Specify --dbs for known uris.Rtat s (RRARDR:RR tlistRtretsplitR/t RuntimeErrorRRQtNonet_currentRR topentwritet setup_configtset_as_current( R/R,RAR:Rtdb_urlstdb_tokenRtdb_urltfile_tcfg((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt _engine_uriMs2   $  % cC@s |jdd�}t|�dS(Nt sqla_testingtrequirement_cls(RQRV(R/R,Rw((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt _requirementsuscC@s�ddlm}ddlm}|jdk r3dS|jd�\}}t|�}x*|jd�dD]}t||�}qhWt||�}|�|_|_ dS(Ni(RA(R:t:t.i( RRARDR:t requirementsRjRht __import__tgetattrtrequires(targumentRAR:tmodnametclsnametmodt componenttreq_cls((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyRV|s c C@sddlm}m}ddlm}ddlm}m}|jrx�|j j �D]�}|j }||�} y| j �} Wnt k r�n:Xx6| D].} |j|j|j| |j����q�W|jjj|�rNy| j dd�} Wnt k r qNXx?| D]4} |j|j|j| |j�dd���qWn|j|| �|jjj|�r�|j|| d|j�n||d�rUddlm} xJ| jd �D]6} |j| j| jd | d d| d���q�WqUqUWndS( Ni(RARB(tagainst(tschematinspectR�t test_schemat postgresql(R�t*tname(RRARBtsqlalchemy.testing.exclusionsR�RDR�R�R tConfigt all_configsRtget_view_namestNotImplementedErrortexecutet _DropViewtTabletMetaDataR{tschemastenabled_for_configtdrop_all_tablesR�tsqlalchemy.dialectsR�t get_enumst DropEnumTypetENUM(R/R,RARBR�R�R�Rttet inspectort view_namestvnameR�tenum((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt_prep_testing_database�sJ          cC@s'|jr#ddlm}|�ndS(Ni(trandomize_unitofwork(Rtsqlalchemy.orm.utilR�(R/R,R�((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt_reverse_topological�s cC@s&ddlm}t|_||_dS(Ni(RA(RRAR/R,(R1R,RA((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt_post_setup_options�s cC@s2ddlm}|j|jdd��|_dS(Ni(R@Rvt profile_file(RR@tProfileStatsFileRQt_profile_stats(R/R,R@((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt_setup_profiling�scC@sjt|tj�stS|jjd�r,tStjjrbt |dt� rbt |dt� rbtSt SdS(NRXt __backend__t__sparse_backend__( t issubclassR;tTestBaseRt__name__t startswithRAR/R R}tTrue(tcls((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/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 �St r�t|d�r�tj|j �j tt �St r�t|d�r�|j j tt �St SdS(Nttest_t__tags__t_sa_exclusion_extend(R�R�Rt __module__RjR#thasattrR=ttagsR�t include_testR$R�R�(R�R2((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt want_method�s"    cc@s�t|dt�s$t|dt�r�t|dt�}x�t|d|�D]�}|j}tjdd|j�}tjdd|�}d|j|f}t||fi|d 6|d 6�}t|||�|VqIWn|VdS( NR�R�tsparses [_\[\]\.]+RXs_+$ts%s_%st_sa_orig_cls_namet__only_on_config__( R}Rt_possible_configs_for_clsR�RgtsubR�Rtsetattr(R�tmoduleR�Rtt orig_namet alpha_nameR�tsubcls((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pytgenerate_sub_tests s  cC@st|�t|�dS(N(t _do_skipst _setup_engine(R�((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pytstart_test_class%s cC@s6tjj�ztjs&tj�nWdt�XdS(N(R<ttesting_reapert_stop_test_ctxR/RR>tglobal_cleanup_assertionst_restore_engine(R�((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pytstop_test_class*s   cC@stjjt�dS(N(RARktresetR:(((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyR�5scC@s"tjj�tj�t�dS(N(R<R�t_stop_test_ctx_aggressiveR>R�R�(((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pytfinal_process_cleanup9s  cC@sAt|dd�r=tjd|j�}tjj|t�ndS(Nt__engine_options__R/( R}RjR<ttesting_engineR�RARkt push_engineR:(R�teng((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyR�?scC@s5t|d|j�}d|||f}|t_dS(NR�s%s.%s.%s(R}R�R@t _current_test(ttestttest_module_namet test_classt test_nameR�tid_((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt before_testEscC@stjj�dS(N(R<R�t_after_test_ctx(R�((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt after_testQscC@s�ttjj��}|jrftj|j�}x3t|�D]"}||�r=|j|�q=q=Wnt |dd�r�tjt j |j ��}x3t|�D]"}||�s�|j|�q�q�Wnt |dd�r�|j|jg�nt|d�r�tj}x|t|�D]k}xb|jD]W}t ||�}|j|�} | r&|j|�|dk ry|j| �nPq&q&WqWnt|d�r$t�} tj}xVt|�D]H}x?|jD]4}t ||�}|j|�s�| j|�q�q�Wq�W|j| �r$|j| �q$n|r�i} xHtt|dd���D]+} | jj} | | krL| | | <qLqLW| j�S|S(Nt __only_on__R�t __requires__t__prefer_requires__tkeycS@s|jj|jjjfS(N(RR�tdialecttserver_version_info(Rt((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt<lambda>�s (tsetRAR�R�t__unsupported_on__R=tdb_specRftremoveR}RjRBtto_listR�tintersection_updateR�R�R{R�tmatching_config_reasonstextendR�R�RYt differencetdifference_updatetreversedRPRR�tvalues(R�treasonsR�R�tspect config_objR{t requirementtcheckt skip_reasonst non_preferredt per_dialectRtR((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyR�UsZ           cC@sig}t||�}t|dt�rmxCt|d�D]/}|�r7tjd|j|jf�q7q7Wn|s�d|jdjd�tjj�D��dj|�f}tj|�n�t |d�r@t �}t j t j|j��}x*|D]"}||�s�|j|�q�q�W|j|�r@|j|�q@ntj|kret|j�|�ndS(Nt __skip_if__s'%s' skipped by %ss.'%s' unsupported on any DB implementation %s%ss, cs@sM|]C}d|jjdjd�tj|j�D��|jjfVqdS(s '%s(%s)+%s'Rzcs@s|]}t|�VqdS(N(tstr(t.0tdig((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pys <genexpr>�sN(RR�tjoinR=t_server_versiontdriver(R�R�((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pys <genexpr>�s t__prefer_backends__(R�R}RRAt skip_testR�R�R�R�R�R�R=R�RBR�RRYR�R�Rkt _setup_configtpop(R�R�R�tctmsgR�R�R�((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyR��s2 !    cC@stjj|t�dS(N(RARktpushR:(R�tctx((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyR�s(ii(Ft__doc__t __future__RRgRRt version_infotpy3kR*R+RjR;R<R=R?R@R>R{RAR:RBR,RGR�R#R$R/RR"R'R)R.R3R6R7R9RFRRRRRR0RCR[R\R]R_RbRcRuRxRVR�R�R�R�R�R�R�R�R�R�R�R�R�R�RR�R�R(((sX/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/plugin/plugin_base.pyt<module>s�                  ( 9        A *