Viewing File: /opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/pytest_plugin.cpython-38.pyc
U
'7`+ @ s d dl Z d dlZd dlZd dlmZ d dlZd dlmZmZ d dl m
Z
ddlmZm
Z
mZmZmZmZmZmZ zd dlZW n ek
r dZY nX zd dlZW n ek
r dZY nX dd Zd d
Zejdd Zejd
d Zejdd Zejd.ddZdd Z dd Z!dd Z"ejdd Z#ejdd Z$ejdd Zejd d! Z%ejd"d# Z&ejd$d% Z'ejd&d' Z(ejd(d) Z)ejd*d+ Z*ejd,d- Z+dS )/ N)Callable)PY_37isasyncgenfunction)Application )BaseTestServer
RawTestServer
TestClient
TestServerloop_contextsetup_test_loopteardown_test_loopunused_portc C s: | j ddddd | j dddd d | j d
dddd d S )N--aiohttp-fast
store_trueFz*run tests faster by disabling extra checks)actiondefaulthelpz--aiohttp-loopZstorepyloopz:run tests with specific loop: pyloop, uvloop, tokio or all--aiohttp-enable-loop-debugzenable event loop debug mode)Z addoption)parser r H/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/pytest_plugin.pypytest_addoption! s$ r c sb | j t rdnt r$dndS dd| jkrH| jd7 _d fdd}|| _ dS )zS
Allow fixtures to be coroutines. Run coroutine fixtures in an event loop.
TFNrequestr c sv |d }r|d= d|j kr$td|d rb| | fdd}|| S | |S d S )Nr loopz^Asynchronous fixtures must depend on the 'loop' fixture or be used in tests depending from it.c s* z W S tk
r$ Y nX d S N)run_until_complete __anext__StopAsyncIterationr _loopgenr r finalizer` s z8pytest_fixture_setup.<locals>.wrapper.<locals>.finalizer)fixturenames ExceptionZgetfixturevalueZaddfinalizerr r )argskwargsr r$ funcZis_async_genZ
strip_requestr! r wrapperK s
z%pytest_fixture_setup.<locals>.wrapper)r* r asyncioiscoroutinefunctionargnames)Z
fixturedefr+ r r) r pytest_fixture_setup6 s
r/ c C s | j dS )z--fast config optionr config getoptionr r r r fastn s r3 c C s | j dS )z!--enable-loop-debug config optionr r0 r r r r
loop_debugt s r4 c c s` t jddJ} dV dd | D }|rRtdt|t|dkrBdnd d
|W 5 Q R X dS )z
Context manager which checks for RuntimeWarnings, specifically to
avoid "coroutine 'X' was never awaited" warnings being missed.
If RuntimeWarnings occur in the context a RuntimeError is raised.
T)recordNc S s"