U ÃÏ aH ã@sndZddlZe e¡Ze dd„¡Ze dd„¡ZgZgZdd„Z dd „Z d d „Z d d „Z dd„Z dd„ZdS)a’ invent a quick version of pytest autouse fixtures as pytest's unacceptably slow collection/high memory use in pytest 4.6.11, which is the highest version that works in py2k. by "too-slow" we mean the test suite can't even manage to be collected for a single process in less than 70 seconds or so and memory use seems to be very high as well. for two or four workers the job just times out after ten minutes. so instead we have invented a very limited form of these fixtures, as our current use of "autouse" fixtures are limited to those in fixtures.py. assumptions for these fixtures: 1. we are only using "function" or "class" scope 2. the functions must be associated with a test class 3. the fixture functions cannot themselves use pytest fixtures 4. the fixture functions must use yield, not return When py2k support is removed and we can stay on a modern pytest version, this can all be removed. éNcCs t t¡S©N©Ú collectionsÚ defaultdictÚset©rrúqC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-nyjtotrf\sqlalchemy\testing\plugin\reinvent_fixtures_py2k.pyÚ"ór cCs t t¡Srrrrrrr %r cCs(|jdkst‚t|j ||jf¡dS)N)ÚclassÚfunction)ÚscopeÚAssertionErrorÚ_py2k_fixture_fn_namesÚ__name__Úadd)ÚfnZfixturerrrÚ add_fixture,srcCs˜|jjj}tD]„}t|D]v\}}t||dƒ}|r|j|kr|jD]H}||jkrB|dkrlt|| |¡n|dkr†t || |¡qŒqBqqqdS)Nr r ) ÚparentÚobjrÚgetattrZim_funcÚ__mro__Ú__dict__Ú_py2k_class_fixturesrÚ_py2k_function_fixtures)ÚitemZ test_classÚnameZ fixture_fnr ÚmethÚsuprrrÚ"scan_for_fixtures_to_use_for_class1s    rcCsZ|j}| |¡}t |¡}|rV|jD]0}| |d¡D]}||ƒ}t|ƒt |¡q4q$dS©Nr)ÚclsÚ__new__rÚgetrÚnextÚ_py2k_cls_fixture_stackÚappend©Úrequestr!ÚselfZfixtures_for_this_classZsup_rÚiter_rrrÚrun_class_fixture_setupBs   r+cCs6tr2t d¡}z t|ƒWqtk r.YqXqdS©Néÿÿÿÿ)r%Úpopr$Ú StopIteration©r(r*rrrÚrun_class_fixture_teardownRs   r1cCsZ|j}|j}t |¡}|rVt|jƒD]0}| |d¡D]}||ƒ}t|ƒt |¡q4q$dSr ) r!Úinstancerr#Úreversedrr$Ú_py2k_fn_fixture_stackr&r'rrrÚrun_fn_fixture_setup[s r5cCs6tr2t d¡}z t|ƒWqtk r.YqXqdSr,)r4r.r$r/r0rrrÚrun_fn_fixture_teardownjs   r6)Ú__doc__rrrrrrr%r4rrr+r1r5r6rrrrÚs  ÿÿ