관리-도구
편집 파일: fixtures.cpython-37.pyc
B �M!V� � @ s d dl Z d dlZd dlmZmZmZ d dlZddlmZ ddl m Z ddlmZmZ ddl mZ ddlmZ dd lmZ d d lmZ ddlmZ dd lmZmZ ddl mZ e�� Ze�dg� e js�G dd� de�Z nd dl!m Z dd� Z"i Z#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: e Zd ZdZdZdZdZdZd dd�Zdd� Z dd� Z dS ) �TestBase� Nc C s |st |��d S )N)�AssertionError)�self�val�msgr r �I/opt/alt/python37/lib/python3.7/site-packages/alembic/testing/fixtures.py�assert_+ s zTestBase.assert_c C s t | d�r| �� d S )N�setUp)�hasattrr )r r r r �setup/ s zTestBase.setupc C s t | d�r| �� d S )N�tearDown)r r )r r r r �teardown3 s zTestBase.teardown)N)�__name__� __module__�__qualname__Z __whitelist__�__requires__Z__unsupported_on__Z__only_on__Z__skip_if__r r r r r r r r s r )r c s( g � � �fdd�} t dd| d���� fS )Nc s � � t| j�jd��� d S )N)�dialect)�append�str�compiler$ )�sqlZmultiparams�params)�buf�enginer r �dump= s zcapture_db.<locals>.dumpz postgresql://r )Zstrategy�executor)r )r, r )r* r+ r � capture_db: s r. c + sh �� dd�rt�� }nt�� }��d|d�� tj� � �fdd�}tj� td|�� |V W d Q R X d S )NZbytes_ioFZsqlite)Zdialect_name� output_bufferc s |j f �� � | |�S )N)�update)�arg�opt)�conf�kwr r � configureR s z)capture_context_buffer.<locals>.configurer5 ) �pop�io�BytesIO�StringIOr0 r r5 r �patch�object)r4 r* r5 r )r3 r4 r �capture_context_bufferE s r<