import{S as sS,i as oS,s as rS,e as l,k as f,w as d,t as o,M as lS,c as a,d as s,m as h,a as i,x as c,h as r,b as u,G as t,g as p,y as m,q as _,o as v,B as w,v as aS}from"../chunks/vendor-hf-doc-builder.js";import{T as PE}from"../chunks/Tip-hf-doc-builder.js";import{I as E}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as y}from"../chunks/CodeBlock-hf-doc-builder.js";function iS(we){let $,O,g,C,A,j,z,D;return{c(){$=l("p"),O=o("This plugin doesn\u2019t work with "),g=l("code"),C=o("-n"),A=o(" flag from "),j=l("code"),z=o("pytest-xdist"),D=o(".")},l(P){$=a(P,"P",{});var b=i($);O=r(b,"This plugin doesn\u2019t work with "),g=a(b,"CODE",{});var S=i(g);C=r(S,"-n"),S.forEach(s),A=r(b," flag from "),j=a(b,"CODE",{});var R=i(j);z=r(R,"pytest-xdist"),R.forEach(s),D=r(b,"."),b.forEach(s)},m(P,b){p(P,$,b),t($,O),t($,g),t(g,C),t($,A),t($,j),t(j,z),t($,D)},d(P){P&&s($)}}}function nS(we){let $,O,g,C,A,j,z,D;return{c(){$=l("p"),O=o("There is another plugin "),g=l("code"),C=o("pytest-repeat"),A=o(", but it doesn\u2019t work with "),j=l("code"),z=o("unittest"),D=o(".")},l(P){$=a(P,"P",{});var b=i($);O=r(b,"There is another plugin "),g=a(b,"CODE",{});var S=i(g);C=r(S,"pytest-repeat"),S.forEach(s),A=r(b,", but it doesn\u2019t work with "),j=a(b,"CODE",{});var R=i(j);z=r(R,"unittest"),R.forEach(s),D=r(b,"."),b.forEach(s)},m(P,b){p(P,$,b),t($,O),t($,g),t(g,C),t($,A),t($,j),t(j,z),t($,D)},d(P){P&&s($)}}}function pS(we){let $,O,g,C,A,j,z,D,P,b,S,R,Nt,ye;return{c(){$=l("p"),O=o("In order to run the equivalent of "),g=l("code"),C=o("rm -r"),A=o(` safely, only subdirs of the project repository checkout are allowed if
an explicit `),j=l("code"),z=o("tmp_dir"),D=o(" is used, so that by mistake no "),P=l("code"),b=o("/tmp"),S=o(` or similar important part of the filesystem will
get nuked. i.e. please always pass paths that start with `),R=l("code"),Nt=o("./"),ye=o(".")},l(Be){$=a(Be,"P",{});var q=i($);O=r(q,"In order to run the equivalent of "),g=a(q,"CODE",{});var me=i(g);C=r(me,"rm -r"),me.forEach(s),A=r(q,` safely, only subdirs of the project repository checkout are allowed if
an explicit `),j=a(q,"CODE",{});var Ye=i(j);z=r(Ye,"tmp_dir"),Ye.forEach(s),D=r(q," is used, so that by mistake no "),P=a(q,"CODE",{});var Ht=i(P);b=r(Ht,"/tmp"),Ht.forEach(s),S=r(q,` or similar important part of the filesystem will
get nuked. i.e. please always pass paths that start with `),R=a(q,"CODE",{});var ti=i(R);Nt=r(ti,"./"),ti.forEach(s),ye=r(q,"."),q.forEach(s)},m(Be,q){p(Be,$,q),t($,O),t($,g),t(g,C),t($,A),t($,j),t(j,z),t($,D),t($,P),t(P,b),t($,S),t($,R),t(R,Nt),t($,ye)},d(Be){Be&&s($)}}}function fS(we){let $,O;return{c(){$=l("p"),O=o(`Each test can register multiple temporary directories and they all will get auto-removed, unless requested
otherwise.`)},l(g){$=a(g,"P",{});var C=i($);O=r(C,`Each test can register multiple temporary directories and they all will get auto-removed, unless requested
otherwise.`),C.forEach(s)},m(g,C){p(g,$,C),t($,O)},d(g){g&&s($)}}}function hS(we){let $,O,g,C,A,j,z,D,P,b,S,R,Nt,ye,Be,q,me,Ye,Ht,ti,OE,IE,si,fp,TE,AE,fm,Ve,zt,hp,Lo,DE,up,qE,hm,Rt,Uo,No,SE,Ho,LE,UE,NE,zo,HE,dp,zE,RE,GE,Ro,Go,FE,Fo,ME,WE,BE,Xe,cp,oi,Mo,YE,VE,XE,mp,L,Wo,JE,ZE,_p,KE,QE,vp,eg,tg,wp,sg,og,yp,rg,lg,$p,ag,ig,ng,Ep,$e,Bo,pg,fg,gp,hg,ug,bp,dg,cg,um,Yo,dm,Gt,mg,Vo,_g,vg,cm,Je,Ft,kp,Xo,wg,Cp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,ky,pe,Ga,iC,Ac,nC,pC,fC,H,hC,Dc,uC,dC,qc,cC,mC,Sc,_C,vC,Lc,wC,yC,Fa,$C,EC,Uc,gC,bC,Nc,kC,CC,Ma,jC,Wa,xC,PC,Cy,Lt,wo,Hc,Ba,OC,zc,IC,jy,An,TC,xy,fe,Rc,AC,DC,Gc,qC,SC,Fc,LC,UC,Mc,NC,Py,Dn,HC,Oy,qn,zC,Iy,Sn,RC,Ty,Ln,GC,Ay,yo,Un,Wc,FC,MC,WC,Ut,BC,Bc,YC,VC,Yc,XC,JC,Dy,Nn,ZC,qy,Ya,Sy,Hn,KC,Ly,Va,Uy,$o,QC,Vc,ej,tj,Ny,Eo,sj,Xc,oj,rj,Hy,zn,lj,zy,go,Jc,Xa,aj,ij,Zc,Ja,nj,Ry;return j=new E({}),Lo=new E({}),Yo=new y({props:{code:`RUN_SLOW=1 pytest tests/
RUN_SLOW=1 pytest examples/`,highlighted:`RUN_SLOW=1 pytest tests/
RUN_SLOW=1 pytest examples/`}}),Xo=new E({}),Jo=new E({}),Ko=new y({props:{code:"pytest",highlighted:"pytest"}}),Qo=new y({props:{code:"make test",highlighted:'make <span class="hljs-built_in">test</span>'}}),er=new y({props:{code:"python -m pytest -n auto --dist=loadfile -s -v ./tests/",highlighted:"python -m pytest -n auto --dist=loadfile -s -v ./tests/"}}),tr=new E({}),sr=new y({props:{code:"pytest --collect-only -q",highlighted:"pytest --collect-only -q"}}),or=new y({props:{code:"pytest tests/test_optimization.py --collect-only -q",highlighted:"pytest tests/test_optimization.py --collect-only -q"}}),rr=new E({}),lr=new y({props:{code:"pytest tests/test_logging.py",highlighted:"pytest tests/test_logging.py"}}),ar=new E({}),ir=new y({props:{code:"pytest tests/test_optimization.py::OptimizationTest::test_adam_w",highlighted:"pytest tests/test_optimization.py::OptimizationTest::test_adam_w"}}),nr=new y({props:{code:"pytest tests/test_optimization.py::OptimizationTest",highlighted:"pytest tests/test_optimization.py::OptimizationTest"}}),pr=new y({props:{code:"pytest tests/test_optimization.py::OptimizationTest --collect-only -q",highlighted:"pytest tests/test_optimization.py::OptimizationTest --collect-only -q"}}),fr=new y({props:{code:"pytest -k adam tests/test_optimization.py",highlighted:"pytest -k adam tests/test_optimization.py"}}),hr=new y({props:{code:'pytest -k "not adam" tests/test_optimization.py',highlighted:'pytest -k <span class="hljs-string">&quot;not adam&quot;</span> tests/test_optimization.py'}}),ur=new y({props:{code:'pytest -k "ada and not adam" tests/test_optimization.py',highlighted:'pytest -k <span class="hljs-string">&quot;ada and not adam&quot;</span> tests/test_optimization.py'}}),dr=new y({props:{code:'pytest -k "test_adam_w or test_adam_w" tests/test_optimization.py',highlighted:'pytest -k <span class="hljs-string">&quot;test_adam_w or test_adam_w&quot;</span> tests/test_optimization.py'}}),cr=new y({props:{code:'pytest -k "test and ada" tests/test_optimization.py',highlighted:'pytest -k <span class="hljs-string">&quot;test and ada&quot;</span> tests/test_optimization.py'}}),mr=new E({}),vr=new y({props:{code:"pip install pytest-picked",highlighted:"pip install pytest-picked"}}),wr=new y({props:{code:"pytest --picked",highlighted:"pytest --picked"}}),yr=new E({}),gr=new y({props:{code:"pip install pytest-xdist",highlighted:"pip install pytest-xdist"}}),br=new y({props:{code:`[tool:pytest]
looponfailroots = transformers tests`,highlighted:`<span class="hljs-section">[tool:pytest]</span>
<span class="hljs-attr">looponfailroots</span> = transformers tests`}}),kr=new y({props:{code:`[pytest]
looponfailroots = transformers tests`,highlighted:`<span class="hljs-section">[pytest]</span>
<span class="hljs-attr">looponfailroots</span> = transformers tests`}}),xr=new E({}),Pr=new y({props:{code:"pytest *ls -1 tests/*py | grep -v test_modeling*",highlighted:'pytest *<span class="hljs-built_in">ls</span> -1 tests/*py | grep -v test_modeling*'}}),Or=new E({}),Ir=new y({props:{code:"pytest --cache-clear tests",highlighted:"pytest --cache-clear tests"}}),Tr=new E({}),Dr=new E({}),qr=new E({}),Lr=new y({props:{code:"pip install pytest-flakefinder",highlighted:"pip install pytest-flakefinder"}}),Ur=new y({props:{code:"pytest --flake-finder --flake-runs=5 tests/test_failing_test.py",highlighted:"pytest --flake-finder --flake-runs=5 tests/test_failing_test.py"}}),ps=new PE({props:{$$slots:{default:[iS]},$$scope:{ctx:we}}}),fs=new PE({props:{$$slots:{default:[nS]},$$scope:{ctx:we}}}),Nr=new E({}),Hr=new y({props:{code:"pip install pytest-random-order",highlighted:"pip install pytest-random-order"}}),zr=new y({props:{code:`pytest tests
[...]
Using --random-order-bucket=module
Using --random-order-seed=573663`,highlighted:`pytest tests
[...]
Using --random-order-bucket=module
Using --random-order-seed=573663`}}),Rr=new y({props:{code:`pytest --random-order-seed=573663
[...]
Using --random-order-bucket=module
Using --random-order-seed=573663`,highlighted:`pytest --random-order-seed=573663
[...]
Using --random-order-bucket=module
Using --random-order-seed=573663`}}),Gr=new y({props:{code:"pytest --random-order-bucket=none tests/test_a.py tests/test_c.py tests/test_b.py",highlighted:"pytest --random-order-bucket=none tests/test_a.py tests/test_c.py tests/test_b.py"}}),Fr=new y({props:{code:"pytest --random-order-bucket=none",highlighted:"pytest --random-order-bucket=none"}}),Br=new E({}),Yr=new E({}),Jr=new y({props:{code:"pip install pytest-sugar",highlighted:"pip install pytest-sugar"}}),Zr=new y({props:{code:"pytest -p no:sugar",highlighted:"pytest -p no:sugar"}}),Kr=new E({}),Qr=new y({props:{code:"pytest --pspec tests/test_optimization.py",highlighted:"pytest --pspec tests/test_optimization.py"}}),el=new E({}),ol=new y({props:{code:"pip install pytest-instafail",highlighted:"pip install pytest-instafail"}}),rl=new y({props:{code:"pytest --instafail",highlighted:"pytest --instafail"}}),ll=new E({}),al=new y({props:{code:'CUDA_VISIBLE_DEVICES="" pytest tests/test_logging.py',highlighted:'CUDA_VISIBLE_DEVICES=<span class="hljs-string">&quot;&quot;</span> pytest tests/test_logging.py'}}),il=new y({props:{code:'CUDA_VISIBLE_DEVICES="1" pytest tests/test_logging.py',highlighted:'CUDA_VISIBLE_DEVICES=<span class="hljs-string">&quot;1&quot;</span> pytest tests/test_logging.py'}}),nl=new y({props:{code:`@require_torch_multi_gpu
def test_example_with_multi_gpu():`,highlighted:`<span class="hljs-meta">@require_torch_multi_gpu</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_example_with_multi_gpu</span>():`}}),pl=new y({props:{code:`@require_tf
def test_tf_thing_with_tensorflow():`,highlighted:`<span class="hljs-meta">@require_tf</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_tf_thing_with_tensorflow</span>():`}}),fl=new y({props:{code:`@require_torch_gpu
@slow
def test_example_slow_on_gpu():`,highlighted:`<span class="hljs-meta">@require_torch_gpu</span>
<span class="hljs-meta">@slow</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_example_slow_on_gpu</span>():`}}),hl=new y({props:{code:`@parameterized.expand(...)
@require_torch_multi_gpu
def test_integration_foo():`,highlighted:`<span class="hljs-meta">@parameterized.expand(<span class="hljs-params">...</span>)</span>
<span class="hljs-meta">@require_torch_multi_gpu</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_integration_foo</span>():`}}),ul=new y({props:{code:`from transformers.testing_utils import get_gpu_count

n_gpu = get_gpu_count()  # works with torch and tf`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> get_gpu_count

n_gpu = get_gpu_count()  <span class="hljs-comment"># works with torch and tf</span>`}}),dl=new E({}),_l=new y({props:{code:"CUDA_VISIBLE_DEVICES=0,1 RUN_SLOW=1 pytest -sv tests/test_trainer_distributed.py",highlighted:"CUDA_VISIBLE_DEVICES=0,1 RUN_SLOW=1 pytest -sv tests/test_trainer_distributed.py"}}),vl=new E({}),wl=new y({props:{code:"pytest -s tests/test_logging.py",highlighted:"pytest -s tests/test_logging.py"}}),yl=new y({props:{code:"py.test tests --junitxml=result.xml",highlighted:"py.test tests --junitxml=result.xml"}}),$l=new E({}),El=new y({props:{code:"pytest --color=no tests/test_logging.py",highlighted:"pytest --color=no tests/test_logging.py"}}),gl=new E({}),bl=new y({props:{code:"pytest --pastebin=failed tests/test_logging.py",highlighted:"pytest --pastebin=failed tests/test_logging.py"}}),kl=new y({props:{code:"pytest --pastebin=all tests/test_logging.py",highlighted:"pytest --pastebin=all tests/test_logging.py"}}),Cl=new E({}),xl=new E({}),Pl=new y({props:{code:`# test_this1.py
import unittest
from parameterized import parameterized


class TestMathUnitTest(unittest.TestCase):
    @parameterized.expand(
        [
            ("negative", -1.5, -2.0),
            ("integer", 1, 1.0),
            ("large fraction", 1.6, 1),
        ]
    )
    def test_floor(self, name, input, expected):
        assert_equal(math.floor(input), expected)`,highlighted:`<span class="hljs-comment"># test_this1.py</span>
<span class="hljs-keyword">import</span> unittest
<span class="hljs-keyword">from</span> parameterized <span class="hljs-keyword">import</span> parameterized


<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestMathUnitTest</span>(unittest.TestCase):
<span class="hljs-meta">    @parameterized.expand(<span class="hljs-params">
        [
            (<span class="hljs-params"><span class="hljs-string">&quot;negative&quot;</span>, -<span class="hljs-number">1.5</span>, -<span class="hljs-number">2.0</span></span>),
            (<span class="hljs-params"><span class="hljs-string">&quot;integer&quot;</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1.0</span></span>),
            (<span class="hljs-params"><span class="hljs-string">&quot;large fraction&quot;</span>, <span class="hljs-number">1.6</span>, <span class="hljs-number">1</span></span>),
        ]
    </span>)</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">test_floor</span>(<span class="hljs-params">self, name, <span class="hljs-built_in">input</span>, expected</span>):
        assert_equal(math.floor(<span class="hljs-built_in">input</span>), expected)`}}),Ol=new y({props:{code:'pytest -k "negative and integer" tests/test_mytest.py',highlighted:'pytest -k <span class="hljs-string">&quot;negative and integer&quot;</span> tests/test_mytest.py'}}),Il=new y({props:{code:'pytest -k "not negative" tests/test_mytest.py',highlighted:'pytest -k <span class="hljs-string">&quot;not negative&quot;</span> tests/test_mytest.py'}}),Tl=new y({props:{code:"pytest test_this1.py --collect-only -q",highlighted:"pytest test_this1.py --collect-only -q"}}),Al=new y({props:{code:`test_this1.py::TestMathUnitTest::test_floor_0_negative
test_this1.py::TestMathUnitTest::test_floor_1_integer
test_this1.py::TestMathUnitTest::test_floor_2_large_fraction`,highlighted:`test_this1.py::TestMathUnitTest::test_floor_0_negative
test_this1.py::TestMathUnitTest::test_floor_1_integer
test_this1.py::TestMathUnitTest::test_floor_2_large_fraction`}}),Dl=new y({props:{code:"pytest test_this1.py::TestMathUnitTest::test_floor_0_negative  test_this1.py::TestMathUnitTest::test_floor_1_integer",highlighted:"pytest test_this1.py::TestMathUnitTest::test_floor_0_negative  test_this1.py::TestMathUnitTest::test_floor_1_integer"}}),Sl=new y({props:{code:`# test_this2.py
import pytest


@pytest.mark.parametrize(
    "name, input, expected",
    [
        ("negative", -1.5, -2.0),
        ("integer", 1, 1.0),
        ("large fraction", 1.6, 1),
    ],
)
def test_floor(name, input, expected):
    assert_equal(math.floor(input), expected)`,highlighted:`<span class="hljs-comment"># test_this2.py</span>
<span class="hljs-keyword">import</span> pytest


<span class="hljs-meta">@pytest.mark.parametrize(<span class="hljs-params">
    <span class="hljs-string">&quot;name, input, expected&quot;</span>,
    [
        (<span class="hljs-params"><span class="hljs-string">&quot;negative&quot;</span>, -<span class="hljs-number">1.5</span>, -<span class="hljs-number">2.0</span></span>),
        (<span class="hljs-params"><span class="hljs-string">&quot;integer&quot;</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1.0</span></span>),
        (<span class="hljs-params"><span class="hljs-string">&quot;large fraction&quot;</span>, <span class="hljs-number">1.6</span>, <span class="hljs-number">1</span></span>),
    ],
</span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_floor</span>(<span class="hljs-params">name, <span class="hljs-built_in">input</span>, expected</span>):
    assert_equal(math.floor(<span class="hljs-built_in">input</span>), expected)`}}),Ll=new y({props:{code:"pytest test_this2.py --collect-only -q",highlighted:"pytest test_this2.py --collect-only -q"}}),Ul=new y({props:{code:`test_this2.py::test_floor[integer-1-1.0]
test_this2.py::test_floor[negative--1.5--2.0]
test_this2.py::test_floor[large fraction-1.6-1]`,highlighted:`test_this2.py::test_floor[integer-1-1.0]
test_this2.py::test_floor[negative--1.5--2.0]
test_this2.py::test_floor[large fraction-1.6-1]`}}),Nl=new y({props:{code:"pytest test_this2.py::test_floor[negative--1.5--2.0] test_this2.py::test_floor[integer-1-1.0]",highlighted:"pytest test_this2.py::test_floor[negative--1.5--2.0] test_this2.py::test_floor[integer-1-1.0]"}}),Hl=new E({}),Ml=new y({props:{code:`from transformers.testing_utils import TestCasePlus


class PathExampleTest(TestCasePlus):
    def test_something_involving_local_locations(self):
        data_dir = self.tests_dir / "fixtures/tests_samples/wmt_en_ro"`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> TestCasePlus


<span class="hljs-keyword">class</span> <span class="hljs-title class_">PathExampleTest</span>(<span class="hljs-title class_ inherited__">TestCasePlus</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">test_something_involving_local_locations</span>(<span class="hljs-params">self</span>):
        data_dir = self.tests_dir / <span class="hljs-string">&quot;fixtures/tests_samples/wmt_en_ro&quot;</span>`}}),Wl=new y({props:{code:`from transformers.testing_utils import TestCasePlus


class PathExampleTest(TestCasePlus):
    def test_something_involving_stringified_locations(self):
        examples_dir = self.examples_dir_str`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> TestCasePlus


<span class="hljs-keyword">class</span> <span class="hljs-title class_">PathExampleTest</span>(<span class="hljs-title class_ inherited__">TestCasePlus</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">test_something_involving_stringified_locations</span>(<span class="hljs-params">self</span>):
        examples_dir = self.examples_dir_str`}}),Bl=new E({}),Yl=new y({props:{code:`from transformers.testing_utils import TestCasePlus


class ExamplesTests(TestCasePlus):
    def test_whatever(self):
        tmp_dir = self.get_auto_remove_tmp_dir()`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> TestCasePlus


<span class="hljs-keyword">class</span> <span class="hljs-title class_">ExamplesTests</span>(<span class="hljs-title class_ inherited__">TestCasePlus</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">test_whatever</span>(<span class="hljs-params">self</span>):
        tmp_dir = self.get_auto_remove_tmp_dir()`}}),Vl=new y({props:{code:`def test_whatever(self):
    tmp_dir = self.get_auto_remove_tmp_dir()`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_whatever</span>(<span class="hljs-params">self</span>):
    tmp_dir = self.get_auto_remove_tmp_dir()`}}),Jl=new y({props:{code:`def test_whatever(self):
    tmp_dir = self.get_auto_remove_tmp_dir("./xxx")`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_whatever</span>(<span class="hljs-params">self</span>):
    tmp_dir = self.get_auto_remove_tmp_dir(<span class="hljs-string">&quot;./xxx&quot;</span>)`}}),Ys=new PE({props:{$$slots:{default:[pS]},$$scope:{ctx:we}}}),Vs=new PE({props:{$$slots:{default:[fS]},$$scope:{ctx:we}}}),Kl=new E({}),Ql=new y({props:{code:`import os
from transformers.testing_utils import ExtendSysPath

bindir = os.path.abspath(os.path.dirname(__file__))
with ExtendSysPath(f"{bindir}/.."):
    from test_trainer import TrainerIntegrationCommon  # noqa`,highlighted:`<span class="hljs-keyword">import</span> os
<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> ExtendSysPath

bindir = os.path.abspath(os.path.dirname(__file__))
<span class="hljs-keyword">with</span> ExtendSysPath(<span class="hljs-string">f&quot;<span class="hljs-subst">{bindir}</span>/..&quot;</span>):
    <span class="hljs-keyword">from</span> test_trainer <span class="hljs-keyword">import</span> TrainerIntegrationCommon  <span class="hljs-comment"># noqa</span>`}}),ea=new E({}),oa=new E({}),ra=new y({props:{code:`@unittest.skip("this bug needs to be fixed")
def test_feature_x():`,highlighted:`<span class="hljs-meta">@unittest.skip(<span class="hljs-params"><span class="hljs-string">&quot;this bug needs to be fixed&quot;</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_feature_x</span>():`}}),la=new y({props:{code:'@pytest.mark.skip(reason="this bug needs to be fixed")',highlighted:'<span class="hljs-meta">@pytest.mark.skip(<span class="hljs-params">reason=<span class="hljs-string">&quot;this bug needs to be fixed&quot;</span></span>)</span>'}}),aa=new y({props:{code:`@pytest.mark.xfail
def test_feature_x():`,highlighted:`<span class="hljs-meta">@pytest.mark.xfail</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_feature_x</span>():`}}),ia=new y({props:{code:`def test_feature_x():
    if not has_something():
        pytest.skip("unsupported configuration")`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_feature_x</span>():
    <span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> has_something():
        pytest.skip(<span class="hljs-string">&quot;unsupported configuration&quot;</span>)`}}),na=new y({props:{code:`import pytest

if not pytest.config.getoption("--custom-flag"):
    pytest.skip("--custom-flag is missing, skipping tests", allow_module_level=True)`,highlighted:`<span class="hljs-keyword">import</span> pytest

<span class="hljs-keyword">if</span> <span class="hljs-keyword">not</span> pytest.config.getoption(<span class="hljs-string">&quot;--custom-flag&quot;</span>):
    pytest.skip(<span class="hljs-string">&quot;--custom-flag is missing, skipping tests&quot;</span>, allow_module_level=<span class="hljs-literal">True</span>)`}}),pa=new y({props:{code:`def test_feature_x():
    pytest.xfail("expected to fail until bug XYZ is fixed")`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_feature_x</span>():
    pytest.xfail(<span class="hljs-string">&quot;expected to fail until bug XYZ is fixed&quot;</span>)`}}),fa=new y({props:{code:'docutils = pytest.importorskip("docutils", minversion="0.3")',highlighted:'docutils = pytest.importorskip(<span class="hljs-string">&quot;docutils&quot;</span>, minversion=<span class="hljs-string">&quot;0.3&quot;</span>)'}}),ha=new y({props:{code:`@pytest.mark.skipif(sys.version_info < (3,6), reason="requires python3.6 or higher")
def test_feature_x():`,highlighted:`<span class="hljs-meta">@pytest.mark.skipif(<span class="hljs-params">sys.version_info &lt; (<span class="hljs-params"><span class="hljs-number">3</span>,<span class="hljs-number">6</span></span>), reason=<span class="hljs-string">&quot;requires python3.6 or higher&quot;</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_feature_x</span>():`}}),ua=new y({props:{code:`@unittest.skipIf(torch_device == "cpu", "Can't do half precision")
def test_feature_x():`,highlighted:`<span class="hljs-meta">@unittest.skipIf(<span class="hljs-params">torch_device == <span class="hljs-string">&quot;cpu&quot;</span>, <span class="hljs-string">&quot;Can&#x27;t do half precision&quot;</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_feature_x</span>():`}}),da=new y({props:{code:`@pytest.mark.skipif(sys.platform == 'win32', reason="does not run on windows")
class TestClass():
    def test_feature_x(self):`,highlighted:`<span class="hljs-meta">@pytest.mark.skipif(<span class="hljs-params">sys.platform == <span class="hljs-string">&#x27;win32&#x27;</span>, reason=<span class="hljs-string">&quot;does not run on windows&quot;</span></span>)</span>
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span>():
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">test_feature_x</span>(<span class="hljs-params">self</span>):`}}),ma=new E({}),_a=new y({props:{code:`from transformers.testing_utils import slow
@slow
def test_integration_foo():`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> slow
<span class="hljs-meta">@slow</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_integration_foo</span>():`}}),va=new y({props:{code:"RUN_SLOW=1 pytest tests",highlighted:"RUN_SLOW=1 pytest tests"}}),wa=new y({props:{code:`@parameteriz ed.expand(...)
@slow
def test_integration_foo():`,highlighted:`<span class="hljs-meta">@parameteriz ed.expand(<span class="hljs-params">...</span>)</span>
<span class="hljs-meta">@slow</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_integration_foo</span>():`}}),ya=new y({props:{code:"grep tiny tests examples",highlighted:"grep tiny tests examples"}}),ga=new E({}),ka=new y({props:{code:`import sys


def print_to_stdout(s):
    print(s)


def print_to_stderr(s):
    sys.stderr.write(s)


def test_result_and_stdout(capsys):
    msg = "Hello"
    print_to_stdout(msg)
    print_to_stderr(msg)
    out, err = capsys.readouterr()  # consume the captured output streams
    # optional: if you want to replay the consumed streams:
    sys.stdout.write(out)
    sys.stderr.write(err)
    # test:
    assert msg in out
    assert msg in err`,highlighted:`<span class="hljs-keyword">import</span> sys


<span class="hljs-keyword">def</span> <span class="hljs-title function_">print_to_stdout</span>(<span class="hljs-params">s</span>):
    <span class="hljs-built_in">print</span>(s)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">print_to_stderr</span>(<span class="hljs-params">s</span>):
    sys.stderr.write(s)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_result_and_stdout</span>(<span class="hljs-params">capsys</span>):
    msg = <span class="hljs-string">&quot;Hello&quot;</span>
    print_to_stdout(msg)
    print_to_stderr(msg)
    out, err = capsys.readouterr()  <span class="hljs-comment"># consume the captured output streams</span>
    <span class="hljs-comment"># optional: if you want to replay the consumed streams:</span>
    sys.stdout.write(out)
    sys.stderr.write(err)
    <span class="hljs-comment"># test:</span>
    <span class="hljs-keyword">assert</span> msg <span class="hljs-keyword">in</span> out
    <span class="hljs-keyword">assert</span> msg <span class="hljs-keyword">in</span> err`}}),Ca=new y({props:{code:`def raise_exception(msg):
    raise ValueError(msg)


def test_something_exception():
    msg = "Not a good value"
    error = ""
    try:
        raise_exception(msg)
    except Exception as e:
        error = str(e)
        assert msg in error, f"{msg} is in the exception:\\n{error}"`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">raise_exception</span>(<span class="hljs-params">msg</span>):
    <span class="hljs-keyword">raise</span> ValueError(msg)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_something_exception</span>():
    msg = <span class="hljs-string">&quot;Not a good value&quot;</span>
    error = <span class="hljs-string">&quot;&quot;</span>
    <span class="hljs-keyword">try</span>:
        raise_exception(msg)
    <span class="hljs-keyword">except</span> Exception <span class="hljs-keyword">as</span> e:
        error = <span class="hljs-built_in">str</span>(e)
        <span class="hljs-keyword">assert</span> msg <span class="hljs-keyword">in</span> error, <span class="hljs-string">f&quot;<span class="hljs-subst">{msg}</span> is in the exception:\\n<span class="hljs-subst">{error}</span>&quot;</span>`}}),ja=new y({props:{code:`from io import StringIO
from contextlib import redirect_stdout


def print_to_stdout(s):
    print(s)


def test_result_and_stdout():
    msg = "Hello"
    buffer = StringIO()
    with redirect_stdout(buffer):
        print_to_stdout(msg)
    out = buffer.getvalue()
    # optional: if you want to replay the consumed streams:
    sys.stdout.write(out)
    # test:
    assert msg in out`,highlighted:`<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> StringIO
<span class="hljs-keyword">from</span> contextlib <span class="hljs-keyword">import</span> redirect_stdout


<span class="hljs-keyword">def</span> <span class="hljs-title function_">print_to_stdout</span>(<span class="hljs-params">s</span>):
    <span class="hljs-built_in">print</span>(s)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">test_result_and_stdout</span>():
    msg = <span class="hljs-string">&quot;Hello&quot;</span>
    buffer = StringIO()
    <span class="hljs-keyword">with</span> redirect_stdout(buffer):
        print_to_stdout(msg)
    out = buffer.getvalue()
    <span class="hljs-comment"># optional: if you want to replay the consumed streams:</span>
    sys.stdout.write(out)
    <span class="hljs-comment"># test:</span>
    <span class="hljs-keyword">assert</span> msg <span class="hljs-keyword">in</span> out`}}),xa=new y({props:{code:`from transformers.testing_utils import CaptureStdout

with CaptureStdout() as cs:
    function_that_writes_to_stdout()
print(cs.out)`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> CaptureStdout

<span class="hljs-keyword">with</span> CaptureStdout() <span class="hljs-keyword">as</span> cs:
    function_that_writes_to_stdout()
<span class="hljs-built_in">print</span>(cs.out)`}}),Pa=new y({props:{code:`from transformers.testing_utils import CaptureStdout

msg = "Secret message\\r"
final = "Hello World"
with CaptureStdout() as cs:
    print(msg + final)
assert cs.out == final + "\\n", f"captured: {cs.out}, expecting {final}"`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> CaptureStdout

msg = <span class="hljs-string">&quot;Secret message\\r&quot;</span>
final = <span class="hljs-string">&quot;Hello World&quot;</span>
<span class="hljs-keyword">with</span> CaptureStdout() <span class="hljs-keyword">as</span> cs:
    <span class="hljs-built_in">print</span>(msg + final)
<span class="hljs-keyword">assert</span> cs.out == final + <span class="hljs-string">&quot;\\n&quot;</span>, <span class="hljs-string">f&quot;captured: <span class="hljs-subst">{cs.out}</span>, expecting <span class="hljs-subst">{final}</span>&quot;</span>`}}),Oa=new y({props:{code:`from transformers.testing_utils import CaptureStderr

with CaptureStderr() as cs:
    function_that_writes_to_stderr()
print(cs.err)`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> CaptureStderr

<span class="hljs-keyword">with</span> CaptureStderr() <span class="hljs-keyword">as</span> cs:
    function_that_writes_to_stderr()
<span class="hljs-built_in">print</span>(cs.err)`}}),Ia=new y({props:{code:`from transformers.testing_utils import CaptureStd

with CaptureStd() as cs:
    function_that_writes_to_stdout_and_stderr()
print(cs.err, cs.out)`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> CaptureStd

<span class="hljs-keyword">with</span> CaptureStd() <span class="hljs-keyword">as</span> cs:
    function_that_writes_to_stdout_and_stderr()
<span class="hljs-built_in">print</span>(cs.err, cs.out)`}}),Ta=new E({}),Aa=new y({props:{code:`from transformers import logging
from transformers.testing_utils import CaptureLogger

msg = "Testing 1, 2, 3"
logging.set_verbosity_info()
logger = logging.get_logger("transformers.models.bart.tokenization_bart")
with CaptureLogger(logger) as cl:
    logger.info(msg)
assert cl.out, msg + "\\n"`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> logging
<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> CaptureLogger

msg = <span class="hljs-string">&quot;Testing 1, 2, 3&quot;</span>
logging.set_verbosity_info()
logger = logging.get_logger(<span class="hljs-string">&quot;transformers.models.bart.tokenization_bart&quot;</span>)
<span class="hljs-keyword">with</span> CaptureLogger(logger) <span class="hljs-keyword">as</span> cl:
    logger.info(msg)
<span class="hljs-keyword">assert</span> cl.out, msg + <span class="hljs-string">&quot;\\n&quot;</span>`}}),Da=new E({}),Sa=new y({props:{code:`from transformers.testing_utils import mockenv


class HfArgumentParserTest(unittest.TestCase):
    @mockenv(TRANSFORMERS_VERBOSITY="error")
    def test_env_override(self):
        env_level_str = os.getenv("TRANSFORMERS_VERBOSITY", None)`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> mockenv


<span class="hljs-keyword">class</span> <span class="hljs-title class_">HfArgumentParserTest</span>(unittest.TestCase):
<span class="hljs-meta">    @mockenv(<span class="hljs-params">TRANSFORMERS_VERBOSITY=<span class="hljs-string">&quot;error&quot;</span></span>)</span>
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">test_env_override</span>(<span class="hljs-params">self</span>):
        env_level_str = os.getenv(<span class="hljs-string">&quot;TRANSFORMERS_VERBOSITY&quot;</span>, <span class="hljs-literal">None</span>)`}}),La=new y({props:{code:`from transformers.testing_utils import TestCasePlus


class EnvExampleTest(TestCasePlus):
    def test_external_prog(self):
        env = self.get_env()
        # now call the external program, passing \`env\` to it`,highlighted:`<span class="hljs-keyword">from</span> transformers.testing_utils <span class="hljs-keyword">import</span> TestCasePlus


<span class="hljs-keyword">class</span> <span class="hljs-title class_">EnvExampleTest</span>(<span class="hljs-title class_ inherited__">TestCasePlus</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">test_external_prog</span>(<span class="hljs-params">self</span>):
        env = self.get_env()
        <span class="hljs-comment"># now call the external program, passing \`env\` to it</span>`}}),Ua=new E({}),Na=new y({props:{code:`seed = 42

# python RNG
import random

random.seed(seed)

# pytorch RNGs
import torch

torch.manual_seed(seed)
torch.backends.cudnn.deterministic = True
if torch.cuda.is_available():
    torch.cuda.manual_seed_all(seed)

# numpy RNG
import numpy as np

np.random.seed(seed)

# tf RNG
tf.random.set_seed(seed)`,highlighted:`seed = <span class="hljs-number">42</span>

<span class="hljs-comment"># python RNG</span>
<span class="hljs-keyword">import</span> random

random.seed(seed)

<span class="hljs-comment"># pytorch RNGs</span>
<span class="hljs-keyword">import</span> torch

torch.manual_seed(seed)
torch.backends.cudnn.deterministic = <span class="hljs-literal">True</span>
<span class="hljs-keyword">if</span> torch.cuda.is_available():
    torch.cuda.manual_seed_all(seed)

<span class="hljs-comment"># numpy RNG</span>
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

np.random.seed(seed)

<span class="hljs-comment"># tf RNG</span>
tf.random.set_seed(seed)`}}),Ha=new E({}),za=new y({props:{code:"pytest tests/test_logging.py -W error::UserWarning --pdb",highlighted:"pytest tests/test_logging.py -W error::UserWarning --pdb"}}),Ra=new E({}),Ba=new E({}),Ya=new y({props:{code:`- run:
    name: run CI experiment
    command: |
        set +euo pipefail
        echo "setting run-all-despite-any-errors-mode"
        this_command_will_fail
        echo "but bash continues to run"
        # emulate another failure
        false
        # but the last command must be a success
        echo "during experiment do not remove: reporting success to CI, even if there were failures"`,highlighted:`<span class="hljs-bullet">-</span> <span class="hljs-attr">run:</span>
    <span class="hljs-attr">name:</span> <span class="hljs-string">run</span> <span class="hljs-string">CI</span> <span class="hljs-string">experiment</span>
    <span class="hljs-attr">command:</span> <span class="hljs-string">|
        set +euo pipefail
        echo &quot;setting run-all-despite-any-errors-mode&quot;
        this_command_will_fail
        echo &quot;but bash continues to run&quot;
        # emulate another failure
        false
        # but the last command must be a success
        echo &quot;during experiment do not remove: reporting success to CI, even if there were failures&quot;</span>`}}),Va=new y({props:{code:"cmd_that_may_fail || true",highlighted:'cmd_that_may_fail || <span class="hljs-literal">true</span>'}}),{c(){$=l("meta"),O=f(),g=l("h1"),C=l("a"),A=l("span"),d(j.$$.fragment),z=f(),D=l("span"),P=o("Testing"),b=f(),S=l("p"),R=o("Let\u2019s take a look at how \u{1F917} Transformers models are tested and how you can write new tests and improve the existing ones."),Nt=f(),ye=l("p"),Be=o("There are 2 test suites in the repository:"),q=f(),me=l("ol"),Ye=l("li"),Ht=l("code"),ti=o("tests"),OE=o(" \u2014 tests for the general API"),IE=f(),si=l("li"),fp=l("code"),TE=o("examples"),AE=o(" \u2014 tests primarily for various applications that aren\u2019t part of the API"),fm=f(),Ve=l("h2"),zt=l("a"),hp=l("span"),d(Lo.$$.fragment),DE=f(),up=l("span"),qE=o("How transformers are tested"),hm=f(),Rt=l("ol"),Uo=l("li"),No=l("p"),SE=o(`Once a PR is submitted it gets tested with 9 CircleCi jobs. Every new commit to that PR gets retested. These jobs
are defined in this `),Ho=l("a"),LE=o("config file"),UE=o(`, so that if needed you can reproduce the same
environment on your machine.`),NE=f(),zo=l("p"),HE=o("These CI jobs don\u2019t run "),dp=l("code"),zE=o("@slow"),RE=o(" tests."),GE=f(),Ro=l("li"),Go=l("p"),FE=o("There are 3 jobs run by "),Fo=l("a"),ME=o("github actions"),WE=o(":"),BE=f(),Xe=l("ul"),cp=l("li"),oi=l("p"),Mo=l("a"),YE=o("torch hub integration"),VE=o(`: checks whether torch hub
integration works.`),XE=f(),mp=l("li"),L=l("p"),Wo=l("a"),JE=o("self-hosted (push)"),ZE=o(`: runs fast tests on GPU only on commits on
`),_p=l("code"),KE=o("main"),QE=o(". It only runs if a commit on "),vp=l("code"),eg=o("main"),tg=o(" has updated the code in one of the following folders: "),wp=l("code"),sg=o("src"),og=o(`,
`),yp=l("code"),rg=o("tests"),lg=o(", "),$p=l("code"),ag=o(".github"),ig=o(" (to prevent running on added model cards, notebooks, etc.)"),ng=f(),Ep=l("li"),$e=l("p"),Bo=l("a"),pg=o("self-hosted runner"),fg=o(`: runs normal and slow tests on GPU in
`),gp=l("code"),hg=o("tests"),ug=o(" and "),bp=l("code"),dg=o("examples"),cg=o(":"),um=f(),d(Yo.$$.fragment),dm=f(),Gt=l("p"),mg=o("The results can be observed "),Vo=l("a"),_g=o("here"),vg=o("."),cm=f(),Je=l("h2"),Ft=l("a"),kp=l("span"),d(Xo.$$.fragment),wg=f(),Cp=l("span"),yg=o("Running tests"),mm=f(),Ze=l("h3"),Mt=l("a"),jp=l("span"),d(Jo.$$.fragment),$g=f(),xp=l("span"),Eg=o("Choosing which tests to run"),_m=f(),Wt=l("p"),gg=o(`This document goes into many details of how tests can be run. If after reading everything, you need even more details
you will find them `),Zo=l("a"),bg=o("here"),kg=o("."),vm=f(),ri=l("p"),Cg=o("Here are some most useful ways of running tests."),wm=f(),li=l("p"),jg=o("Run all:"),ym=f(),d(Ko.$$.fragment),$m=f(),ai=l("p"),xg=o("or:"),Em=f(),d(Qo.$$.fragment),gm=f(),ii=l("p"),Pg=o("Note that the latter is defined as:"),bm=f(),d(er.$$.fragment),km=f(),ni=l("p"),Og=o("which tells pytest to:"),Cm=f(),Q=l("ul"),Pp=l("li"),Ig=o("run as many test processes as they are CPU cores (which could be too many if you don\u2019t have a ton of RAM!)"),Tg=f(),Op=l("li"),Ag=o("ensure that all tests from the same file will be run by the same test process"),Dg=f(),Ip=l("li"),qg=o("do not capture output"),Sg=f(),Tp=l("li"),Lg=o("run in verbose mode"),jm=f(),Ke=l("h3"),Bt=l("a"),Ap=l("span"),d(tr.$$.fragment),Ug=f(),Dp=l("span"),Ng=o("Getting the list of all tests"),xm=f(),pi=l("p"),Hg=o("All tests of the test suite:"),Pm=f(),d(sr.$$.fragment),Om=f(),fi=l("p"),zg=o("All tests of a given test file:"),Im=f(),d(or.$$.fragment),Tm=f(),Qe=l("h3"),Yt=l("a"),qp=l("span"),d(rr.$$.fragment),Rg=f(),Sp=l("span"),Gg=o("Run a specific test module"),Am=f(),hi=l("p"),Fg=o("To run an individual test module:"),Dm=f(),d(lr.$$.fragment),qm=f(),et=l("h3"),Vt=l("a"),Lp=l("span"),d(ar.$$.fragment),Mg=f(),Up=l("span"),Wg=o("Run specific tests"),Sm=f(),ui=l("p"),Bg=o(`Since unittest is used inside most of the tests, to run specific subtests you need to know the name of the unittest
class containing those tests. For example, it could be:`),Lm=f(),d(ir.$$.fragment),Um=f(),di=l("p"),Yg=o("Here:"),Nm=f(),Ee=l("ul"),ci=l("li"),Np=l("code"),Vg=o("tests/test_optimization.py"),Xg=o(" - the file with tests"),Jg=f(),mi=l("li"),Hp=l("code"),Zg=o("OptimizationTest"),Kg=o(" - the name of the class"),Qg=f(),_i=l("li"),zp=l("code"),eb=o("test_adam_w"),tb=o(" - the name of the specific test function"),Hm=f(),vi=l("p"),sb=o("If the file contains multiple classes, you can choose to run only tests of a given class. For example:"),zm=f(),d(nr.$$.fragment),Rm=f(),wi=l("p"),ob=o("will run all the tests inside that class."),Gm=f(),Xt=l("p"),rb=o("As mentioned earlier you can see what tests are contained inside the "),Rp=l("code"),lb=o("OptimizationTest"),ab=o(" class by running:"),Fm=f(),d(pr.$$.fragment),Mm=f(),yi=l("p"),ib=o("You can run tests by keyword expressions."),Wm=f(),Jt=l("p"),nb=o("To run only tests whose name contains "),Gp=l("code"),pb=o("adam"),fb=o(":"),Bm=f(),d(fr.$$.fragment),Ym=f(),ee=l("p"),hb=o("Logical "),Fp=l("code"),ub=o("and"),db=o(" and "),Mp=l("code"),cb=o("or"),mb=o(" can be used to indicate whether all keywords should match or either. "),Wp=l("code"),_b=o("not"),vb=o(` can be used to
negate.`),Vm=f(),Zt=l("p"),wb=o("To run all tests except those whose name contains "),Bp=l("code"),yb=o("adam"),$b=o(":"),Xm=f(),d(hr.$$.fragment),Jm=f(),$i=l("p"),Eb=o("And you can combine the two patterns in one:"),Zm=f(),d(ur.$$.fragment),Km=f(),ge=l("p"),gb=o("For example to run both "),Yp=l("code"),bb=o("test_adafactor"),kb=o(" and "),Vp=l("code"),Cb=o("test_adam_w"),jb=o(" you can use:"),Qm=f(),d(dr.$$.fragment),e_=f(),Kt=l("p"),xb=o("Note that we use "),Xp=l("code"),Pb=o("or"),Ob=o(" here, since we want either of the keywords to match to include both."),t_=f(),Qt=l("p"),Ib=o("If you want to include only tests that include both patterns, "),Jp=l("code"),Tb=o("and"),Ab=o(" is to be used:"),s_=f(),d(cr.$$.fragment),o_=f(),tt=l("h3"),es=l("a"),Zp=l("span"),d(mr.$$.fragment),Db=f(),Kp=l("span"),qb=o("Run only modified tests"),r_=f(),ts=l("p"),Sb=o("You can run the tests related to the unstaged files or the current branch (according to Git) by using "),_r=l("a"),Lb=o("pytest-picked"),Ub=o(`. This is a great way of quickly testing your changes didn\u2019t break
anything, since it won\u2019t run the tests related to files you didn\u2019t touch.`),l_=f(),d(vr.$$.fragment),a_=f(),d(wr.$$.fragment),i_=f(),Ei=l("p"),Nb=o("All tests will be run from files and folders which are modified, but not yet committed."),n_=f(),st=l("h3"),ss=l("a"),Qp=l("span"),d(yr.$$.fragment),Hb=f(),ef=l("span"),zb=o("Automatically rerun failed tests on source modification"),p_=f(),$r=l("p"),Er=l("a"),Rb=o("pytest-xdist"),Gb=o(` provides a very useful feature of detecting all failed
tests, and then waiting for you to modify files and continuously re-rerun those failing tests until they pass while you
fix them. So that you don\u2019t need to re start pytest after you made the fix. This is repeated until all tests pass after
which again a full run is performed.`),f_=f(),d(gr.$$.fragment),h_=f(),ot=l("p"),Fb=o("To enter the mode: "),tf=l("code"),Mb=o("pytest -f"),Wb=o(" or "),sf=l("code"),Bb=o("pytest --looponfail"),u_=f(),be=l("p"),Yb=o("File changes are detected by looking at "),of=l("code"),Vb=o("looponfailroots"),Xb=o(` root directories and all of their contents (recursively).
If the default for this value does not work for you, you can change it in your project by setting a configuration
option in `),rf=l("code"),Jb=o("setup.cfg"),Zb=o(":"),d_=f(),d(br.$$.fragment),c_=f(),ke=l("p"),Kb=o("or "),lf=l("code"),Qb=o("pytest.ini"),e3=o("/"),af=l("code"),t3=o("tox.ini"),s3=o(" files:"),m_=f(),d(kr.$$.fragment),__=f(),gi=l("p"),o3=o(`This would lead to only looking for file changes in the respective directories, specified relatively to the ini-file\u2019s
directory.`),v_=f(),Cr=l("p"),jr=l("a"),r3=o("pytest-watch"),l3=o(" is an alternative implementation of this functionality."),w_=f(),rt=l("h3"),os=l("a"),nf=l("span"),d(xr.$$.fragment),a3=f(),pf=l("span"),i3=o("Skip a test module"),y_=f(),rs=l("p"),n3=o(`If you want to run all test modules, except a few you can exclude them by giving an explicit list of tests to run. For
example, to run all except `),ff=l("code"),p3=o("test_modeling_*.py"),f3=o(" tests:"),$_=f(),d(Pr.$$.fragment),E_=f(),lt=l("h3"),ls=l("a"),hf=l("span"),d(Or.$$.fragment),h3=f(),uf=l("span"),u3=o("Clearing state"),g_=f(),bi=l("p"),d3=o("CI builds and when isolation is important (against speed), cache should be cleared:"),b_=f(),d(Ir.$$.fragment),k_=f(),at=l("h3"),as=l("a"),df=l("span"),d(Tr.$$.fragment),c3=f(),cf=l("span"),m3=o("Running tests in parallel"),C_=f(),M=l("p"),_3=o("As mentioned earlier "),mf=l("code"),v3=o("make test"),w3=o(" runs tests in parallel via "),_f=l("code"),y3=o("pytest-xdist"),$3=o(" plugin ("),vf=l("code"),E3=o("-n X"),g3=o(" argument, e.g. "),wf=l("code"),b3=o("-n 2"),k3=o(`
to run 2 parallel jobs).`),j_=f(),_e=l("p"),yf=l("code"),C3=o("pytest-xdist"),j3=o("\u2019s "),$f=l("code"),x3=o("--dist="),P3=o(" option allows one to control how the tests are grouped. "),Ef=l("code"),O3=o("--dist=loadfile"),I3=o(` puts the
tests located in one file onto the same process.`),x_=f(),Ce=l("p"),T3=o("Since the order of executed tests is different and unpredictable, if running the test suite with "),gf=l("code"),A3=o("pytest-xdist"),D3=o(`
produces failures (meaning we have some undetected coupled tests), use `),Ar=l("a"),q3=o("pytest-replay"),S3=o(` to replay the tests in the same order, which should help with then somehow
reducing that failing sequence to a minimum.`),P_=f(),it=l("h3"),is=l("a"),bf=l("span"),d(Dr.$$.fragment),L3=f(),kf=l("span"),U3=o("Test order and repetition"),O_=f(),ki=l("p"),N3=o(`It\u2019s good to repeat the tests several times, in sequence, randomly, or in sets, to detect any potential
inter-dependency and state-related bugs (tear down). And the straightforward multiple repetition is just good to detect
some problems that get uncovered by randomness of DL.`),I_=f(),nt=l("h4"),ns=l("a"),Cf=l("span"),d(qr.$$.fragment),H3=f(),jf=l("span"),z3=o("Repeat tests"),T_=f(),Ci=l("ul"),ji=l("li"),Sr=l("a"),R3=o("pytest-flakefinder"),G3=o(":"),A_=f(),d(Lr.$$.fragment),D_=f(),xi=l("p"),F3=o("And then run every test multiple times (50 by default):"),q_=f(),d(Ur.$$.fragment),S_=f(),d(ps.$$.fragment),L_=f(),d(fs.$$.fragment),U_=f(),pt=l("h4"),hs=l("a"),xf=l("span"),d(Nr.$$.fragment),M3=f(),Pf=l("span"),W3=o("Run tests in a random order"),N_=f(),d(Hr.$$.fragment),H_=f(),us=l("p"),B3=o("Important: the presence of "),Of=l("code"),Y3=o("pytest-random-order"),V3=o(` will automatically randomize tests, no configuration change or
command line options is required.`),z_=f(),ds=l("p"),X3=o(`As explained earlier this allows detection of coupled tests - where one test\u2019s state affects the state of another. When
`),If=l("code"),J3=o("pytest-random-order"),Z3=o(" is installed it will print the random seed it used for that session, e.g:"),R_=f(),d(zr.$$.fragment),G_=f(),Pi=l("p"),K3=o("So that if the given particular sequence fails, you can reproduce it by adding that exact seed, e.g.:"),F_=f(),d(Rr.$$.fragment),M_=f(),cs=l("p"),Q3=o(`It will only reproduce the exact order if you use the exact same list of tests (or no list at all). Once you start to
manually narrowing down the list you can no longer rely on the seed, but have to list them manually in the exact order
they failed and tell pytest to not randomize them instead using `),Tf=l("code"),e2=o("--random-order-bucket=none"),t2=o(", e.g.:"),W_=f(),d(Gr.$$.fragment),B_=f(),Oi=l("p"),s2=o("To disable the shuffling for all tests:"),Y_=f(),d(Fr.$$.fragment),V_=f(),I=l("p"),o2=o("By default "),Af=l("code"),r2=o("--random-order-bucket=module"),l2=o(` is implied, which will shuffle the files on the module levels. It can also
shuffle on `),Df=l("code"),a2=o("class"),i2=o(", "),qf=l("code"),n2=o("package"),p2=o(", "),Sf=l("code"),f2=o("global"),h2=o(" and "),Lf=l("code"),u2=o("none"),d2=o(` levels. For the complete details please see its
`),Mr=l("a"),c2=o("documentation"),m2=o("."),X_=f(),je=l("p"),_2=o("Another randomization alternative is: "),Wr=l("a"),Uf=l("code"),v2=o("pytest-randomly"),w2=o(`. This
module has a very similar functionality/interface, but it doesn\u2019t have the bucket modes available in
`),Nf=l("code"),y2=o("pytest-random-order"),$2=o(". It has the same problem of imposing itself once installed."),J_=f(),ft=l("h3"),ms=l("a"),Hf=l("span"),d(Br.$$.fragment),E2=f(),zf=l("span"),g2=o("Look and feel variations"),Z_=f(),ht=l("h4"),_s=l("a"),Rf=l("span"),d(Yr.$$.fragment),b2=f(),Gf=l("span"),k2=o("pytest-sugar"),K_=f(),Vr=l("p"),Xr=l("a"),C2=o("pytest-sugar"),j2=o(` is a plugin that improves the look-n-feel, adds a
progressbar, and show tests that fail and the assert instantly. It gets activated automatically upon installation.`),Q_=f(),d(Jr.$$.fragment),ev=f(),Ii=l("p"),x2=o("To run tests without it, run:"),tv=f(),d(Zr.$$.fragment),sv=f(),Ti=l("p"),P2=o("or uninstall it."),ov=f(),ut=l("h4"),vs=l("a"),Ff=l("span"),d(Kr.$$.fragment),O2=f(),Mf=l("span"),I2=o("Report each sub-test name and its progress"),rv=f(),xe=l("p"),T2=o("For a single or a group of tests via "),Wf=l("code"),A2=o("pytest"),D2=o(" (after "),Bf=l("code"),q2=o("pip install pytest-pspec"),S2=o("):"),lv=f(),d(Qr.$$.fragment),av=f(),dt=l("h4"),ws=l("a"),Yf=l("span"),d(el.$$.fragment),L2=f(),Vf=l("span"),U2=o("Instantly shows failed tests"),iv=f(),tl=l("p"),sl=l("a"),N2=o("pytest-instafail"),H2=o(` shows failures and errors instantly instead of
waiting until the end of test session.`),nv=f(),d(ol.$$.fragment),pv=f(),d(rl.$$.fragment),fv=f(),ct=l("h3"),ys=l("a"),Xf=l("span"),d(ll.$$.fragment),z2=f(),Jf=l("span"),R2=o("To GPU or not to GPU"),hv=f(),$s=l("p"),G2=o("On a GPU-enabled setup, to test in CPU-only mode add "),Zf=l("code"),F2=o('CUDA_VISIBLE_DEVICES=""'),M2=o(":"),uv=f(),d(al.$$.fragment),dv=f(),te=l("p"),W2=o("or if you have multiple gpus, you can specify which one is to be used by "),Kf=l("code"),B2=o("pytest"),Y2=o(`. For example, to use only the
second gpu if you have gpus `),Qf=l("code"),V2=o("0"),X2=o(" and "),eh=l("code"),J2=o("1"),Z2=o(", you can run:"),cv=f(),d(il.$$.fragment),mv=f(),Ai=l("p"),K2=o("This is handy when you want to run different tasks on different GPUs."),_v=f(),Di=l("p"),Q2=o(`Some tests must be run on CPU-only, others on either CPU or GPU or TPU, yet others on multiple-GPUs. The following skip
decorators are used to set the requirements of tests CPU/GPU/TPU-wise:`),vv=f(),U=l("ul"),qi=l("li"),th=l("code"),e5=o("require_torch"),t5=o(" - this test will run only under torch"),s5=f(),Es=l("li"),sh=l("code"),o5=o("require_torch_gpu"),r5=o(" - as "),oh=l("code"),l5=o("require_torch"),a5=o(" plus requires at least 1 GPU"),i5=f(),gs=l("li"),rh=l("code"),n5=o("require_torch_multi_gpu"),p5=o(" - as "),lh=l("code"),f5=o("require_torch"),h5=o(" plus requires at least 2 GPUs"),u5=f(),bs=l("li"),ah=l("code"),d5=o("require_torch_non_multi_gpu"),c5=o(" - as "),ih=l("code"),m5=o("require_torch"),_5=o(" plus requires 0 or 1 GPUs"),v5=f(),ks=l("li"),nh=l("code"),w5=o("require_torch_up_to_2_gpus"),y5=o(" - as "),ph=l("code"),$5=o("require_torch"),E5=o(" plus requires 0 or 1 or 2 GPUs"),g5=f(),Cs=l("li"),fh=l("code"),b5=o("require_torch_tpu"),k5=o(" - as "),hh=l("code"),C5=o("require_torch"),j5=o(" plus requires at least 1 TPU"),wv=f(),Si=l("p"),x5=o("Let\u2019s depict the GPU requirements in the following table:"),yv=f(),k=l("p"),P5=o(`| n gpus | decorator                      |
|--------+--------------------------------|
| `),uh=l("code"),O5=o(">= 0"),I5=o(" | "),dh=l("code"),T5=o("@require_torch"),A5=o(`               |
| `),ch=l("code"),D5=o(">= 1"),q5=o(" | "),mh=l("code"),S5=o("@require_torch_gpu"),L5=o(`           |
| `),_h=l("code"),U5=o(">= 2"),N5=o(" | "),vh=l("code"),H5=o("@require_torch_multi_gpu"),z5=o(`     |
| `),wh=l("code"),R5=o("< 2"),G5=o("  | "),yh=l("code"),F5=o("@require_torch_non_multi_gpu"),M5=o(` |
| `),$h=l("code"),W5=o("< 3"),B5=o("  | "),Eh=l("code"),Y5=o("@require_torch_up_to_2_gpus"),V5=o("  |"),$v=f(),Li=l("p"),X5=o("For example, here is a test that must be run only when there are 2 or more GPUs available and pytorch is installed:"),Ev=f(),d(nl.$$.fragment),gv=f(),Pe=l("p"),J5=o("If a test requires "),gh=l("code"),Z5=o("tensorflow"),K5=o(" use the "),bh=l("code"),Q5=o("require_tf"),ek=o(" decorator. For example:"),bv=f(),d(pl.$$.fragment),kv=f(),Ui=l("p"),tk=o(`These decorators can be stacked. For example, if a test is slow and requires at least one GPU under pytorch, here is
how to set it up:`),Cv=f(),d(fl.$$.fragment),jv=f(),Oe=l("p"),sk=o("Some decorators like "),kh=l("code"),ok=o("@parametrized"),rk=o(" rewrite test names, therefore "),Ch=l("code"),lk=o("@require_*"),ak=o(` skip decorators have to be listed
last for them to work correctly. Here is an example of the correct usage:`),xv=f(),d(hl.$$.fragment),Pv=f(),js=l("p"),ik=o("This order problem doesn\u2019t exist with "),jh=l("code"),nk=o("@pytest.mark.parametrize"),pk=o(`, you can put it first or last and it will still
work. But it only works with non-unittests.`),Ov=f(),Ni=l("p"),fk=o("Inside tests:"),Iv=f(),Hi=l("ul"),xh=l("li"),hk=o("How many GPUs are available:"),Tv=f(),d(ul.$$.fragment),Av=f(),mt=l("h3"),xs=l("a"),Ph=l("span"),d(dl.$$.fragment),uk=f(),Oh=l("span"),dk=o("Distributed training"),Dv=f(),_t=l("p"),Ih=l("code"),ck=o("pytest"),mk=o(` can\u2019t deal with distributed training directly. If this is attempted - the sub-processes don\u2019t do the right
thing and end up thinking they are `),Th=l("code"),_k=o("pytest"),vk=o(` and start running the test suite in loops. It works, however, if one
spawns a normal process that then spawns off multiple workers and manages the IO pipes.`),qv=f(),zi=l("p"),wk=o("Here are some tests that use it:"),Sv=f(),Ps=l("ul"),Ah=l("li"),cl=l("a"),yk=o("test_trainer_distributed.py"),$k=f(),Dh=l("li"),ml=l("a"),Ek=o("test_deepspeed.py"),Lv=f(),Os=l("p"),gk=o("To jump right into the execution point, search for the "),qh=l("code"),bk=o("execute_subprocess_async"),kk=o(" call in those tests."),Uv=f(),Ri=l("p"),Ck=o("You will need at least 2 GPUs to see these tests in action:"),Nv=f(),d(_l.$$.fragment),Hv=f(),vt=l("h3"),Is=l("a"),Sh=l("span"),d(vl.$$.fragment),jk=f(),Lh=l("span"),xk=o("Output capture"),zv=f(),Ie=l("p"),Pk=o("During test execution any output sent to "),Uh=l("code"),Ok=o("stdout"),Ik=o(" and "),Nh=l("code"),Tk=o("stderr"),Ak=o(` is captured. If a test or a setup method fails, its
according captured output will usually be shown along with the failure traceback.`),Rv=f(),W=l("p"),Dk=o("To disable output capturing and to get the "),Hh=l("code"),qk=o("stdout"),Sk=o(" and "),zh=l("code"),Lk=o("stderr"),Uk=o(" normally, use "),Rh=l("code"),Nk=o("-s"),Hk=o(" or "),Gh=l("code"),zk=o("--capture=no"),Rk=o(":"),Gv=f(),d(wl.$$.fragment),Fv=f(),Gi=l("p"),Gk=o("To send test results to JUnit format output:"),Mv=f(),d(yl.$$.fragment),Wv=f(),wt=l("h3"),Ts=l("a"),Fh=l("span"),d($l.$$.fragment),Fk=f(),Mh=l("span"),Mk=o("Color control"),Bv=f(),Fi=l("p"),Wk=o("To have no color (e.g., yellow on white background is not readable):"),Yv=f(),d(El.$$.fragment),Vv=f(),yt=l("h3"),As=l("a"),Wh=l("span"),d(gl.$$.fragment),Bk=f(),Bh=l("span"),Yk=o("Sending test report to online pastebin service"),Xv=f(),Mi=l("p"),Vk=o("Creating a URL for each test failure:"),Jv=f(),d(bl.$$.fragment),Zv=f(),Wi=l("p"),Xk=o(`This will submit test run information to a remote Paste service and provide a URL for each failure. You may select
tests as usual or add for example -x if you only want to send one particular failure.`),Kv=f(),Bi=l("p"),Jk=o("Creating a URL for a whole test session log:"),Qv=f(),d(kl.$$.fragment),e1=f(),$t=l("h2"),Ds=l("a"),Yh=l("span"),d(Cl.$$.fragment),Zk=f(),Vh=l("span"),Kk=o("Writing tests"),t1=f(),Te=l("p"),Qk=o("\u{1F917} transformers tests are based on "),Xh=l("code"),e4=o("unittest"),t4=o(", but run by "),Jh=l("code"),s4=o("pytest"),o4=o(`, so most of the time features from both systems
can be used.`),s1=f(),se=l("p"),r4=o("You can read "),jl=l("a"),l4=o("here"),a4=o(` which features are supported, but the important
thing to remember is that most `),Zh=l("code"),i4=o("pytest"),n4=o(` fixtures don\u2019t work. Neither parametrization, but we use the module
`),Kh=l("code"),p4=o("parameterized"),f4=o(" that works in a similar way."),o1=f(),Et=l("h3"),qs=l("a"),Qh=l("span"),d(xl.$$.fragment),h4=f(),eu=l("span"),u4=o("Parametrization"),r1=f(),Yi=l("p"),d4=o(`Often, there is a need to run the same test multiple times, but with different arguments. It could be done from within
the test, but then there is no way of running that test for just one set of arguments.`),l1=f(),d(Pl.$$.fragment),a1=f(),Ss=l("p"),c4=o("Now, by default this test will be run 3 times, each time with the last 3 arguments of "),tu=l("code"),m4=o("test_floor"),_4=o(` being assigned the
corresponding arguments in the parameter list.`),i1=f(),Ae=l("p"),v4=o("and you could run just the "),su=l("code"),w4=o("negative"),y4=o(" and "),ou=l("code"),$4=o("integer"),E4=o(" sets of params with:"),n1=f(),d(Ol.$$.fragment),p1=f(),Ls=l("p"),g4=o("or all but "),ru=l("code"),b4=o("negative"),k4=o(" sub-tests, with:"),f1=f(),d(Il.$$.fragment),h1=f(),Us=l("p"),C4=o("Besides using the "),lu=l("code"),j4=o("-k"),x4=o(` filter that was just mentioned, you can find out the exact name of each sub-test and run any
or all of them using their exact names.`),u1=f(),d(Tl.$$.fragment),d1=f(),Vi=l("p"),P4=o("and it will list:"),c1=f(),d(Al.$$.fragment),m1=f(),Xi=l("p"),O4=o("So now you can run just 2 specific sub-tests:"),_1=f(),d(Dl.$$.fragment),v1=f(),B=l("p"),I4=o("The module "),ql=l("a"),T4=o("parameterized"),A4=o(` which is already in the developer dependencies
of `),au=l("code"),D4=o("transformers"),q4=o(" works for both: "),iu=l("code"),S4=o("unittests"),L4=o(" and "),nu=l("code"),U4=o("pytest"),N4=o(" tests."),w1=f(),oe=l("p"),H4=o("If, however, the test is not a "),pu=l("code"),z4=o("unittest"),R4=o(", you may use "),fu=l("code"),G4=o("pytest.mark.parametrize"),F4=o(` (or you may see it being used in
some existing tests, mostly under `),hu=l("code"),M4=o("examples"),W4=o(")."),y1=f(),De=l("p"),B4=o("Here is the same example, this time using "),uu=l("code"),Y4=o("pytest"),V4=o("\u2019s "),du=l("code"),X4=o("parametrize"),J4=o(" marker:"),$1=f(),d(Sl.$$.fragment),E1=f(),re=l("p"),Z4=o("Same as with "),cu=l("code"),K4=o("parameterized"),Q4=o(", with "),mu=l("code"),e0=o("pytest.mark.parametrize"),t0=o(` you can have a fine control over which sub-tests are
run, if the `),_u=l("code"),s0=o("-k"),o0=o(` filter doesn\u2019t do the job. Except, this parametrization function creates a slightly different set of
names for the sub-tests. Here is what they look like:`),g1=f(),d(Ll.$$.fragment),b1=f(),Ji=l("p"),r0=o("and it will list:"),k1=f(),d(Ul.$$.fragment),C1=f(),Zi=l("p"),l0=o("So now you can run just the specific test:"),j1=f(),d(Nl.$$.fragment),x1=f(),Ki=l("p"),a0=o("as in the previous example."),P1=f(),gt=l("h3"),Ns=l("a"),vu=l("span"),d(Hl.$$.fragment),i0=f(),wu=l("span"),n0=o("Files and directories"),O1=f(),Hs=l("p"),p0=o(`In tests often we need to know where things are relative to the current test file, and it\u2019s not trivial since the test
could be invoked from more than one directory or could reside in sub-directories with different depths. A helper class
`),yu=l("code"),f0=o("transformers.test_utils.TestCasePlus"),h0=o(` solves this problem by sorting out all the basic paths and provides easy
accessors to them:`),I1=f(),zs=l("ul"),zl=l("li"),Qi=l("p"),$u=l("code"),u0=o("pathlib"),d0=o(" objects (all fully resolved):"),c0=f(),G=l("ul"),Rl=l("li"),Eu=l("code"),m0=o("test_file_path"),_0=o(" - the current test file path, i.e. "),gu=l("code"),v0=o("__file__"),w0=f(),en=l("li"),bu=l("code"),y0=o("test_file_dir"),$0=o(" - the directory containing the current test file"),E0=f(),Rs=l("li"),ku=l("code"),g0=o("tests_dir"),b0=o(" - the directory of the "),Cu=l("code"),k0=o("tests"),C0=o(" test suite"),j0=f(),Gs=l("li"),ju=l("code"),x0=o("examples_dir"),P0=o(" - the directory of the "),xu=l("code"),O0=o("examples"),I0=o(" test suite"),T0=f(),tn=l("li"),Pu=l("code"),A0=o("repo_root_dir"),D0=o(" - the directory of the repository"),q0=f(),qe=l("li"),Ou=l("code"),S0=o("src_dir"),L0=o(" - the directory of "),Iu=l("code"),U0=o("src"),N0=o(" (i.e. where the "),Tu=l("code"),H0=o("transformers"),z0=o(" sub-dir resides)"),R0=f(),Gl=l("li"),Fl=l("p"),G0=o("stringified paths---same as above but these return paths as strings, rather than "),Au=l("code"),F0=o("pathlib"),M0=o(" objects:"),W0=f(),F=l("ul"),Du=l("li"),qu=l("code"),B0=o("test_file_path_str"),Y0=f(),Su=l("li"),Lu=l("code"),V0=o("test_file_dir_str"),X0=f(),Uu=l("li"),Nu=l("code"),J0=o("tests_dir_str"),Z0=f(),Hu=l("li"),zu=l("code"),K0=o("examples_dir_str"),Q0=f(),Ru=l("li"),Gu=l("code"),e6=o("repo_root_dir_str"),t6=f(),Fu=l("li"),Mu=l("code"),s6=o("src_dir_str"),T1=f(),Fs=l("p"),o6=o(`To start using those all you need is to make sure that the test resides in a subclass of
`),Wu=l("code"),r6=o("transformers.test_utils.TestCasePlus"),l6=o(". For example:"),A1=f(),d(Ml.$$.fragment),D1=f(),Y=l("p"),a6=o("If you don\u2019t need to manipulate paths via "),Bu=l("code"),i6=o("pathlib"),n6=o(` or you just need a path as a string, you can always invoked
`),Yu=l("code"),p6=o("str()"),f6=o(" on the "),Vu=l("code"),h6=o("pathlib"),u6=o(" object or use the accessors ending with "),Xu=l("code"),d6=o("_str"),c6=o(". For example:"),q1=f(),d(Wl.$$.fragment),S1=f(),bt=l("h3"),Ms=l("a"),Ju=l("span"),d(Bl.$$.fragment),m6=f(),Zu=l("span"),_6=o("Temporary files and directories"),L1=f(),Ws=l("p"),v6=o(`Using unique temporary files and directories are essential for parallel test running, so that the tests won\u2019t overwrite
each other\u2019s data. Also we want to get the temporary files and directories removed at the end of each test that created
them. Therefore, using packages like `),Ku=l("code"),w6=o("tempfile"),y6=o(", which address these needs is essential."),U1=f(),sn=l("p"),$6=o(`However, when debugging tests, you need to be able to see what goes into the temporary file or directory and you want
to know it\u2019s exact path and not having it randomized on every test re-run.`),N1=f(),Se=l("p"),E6=o("A helper class "),Qu=l("code"),g6=o("transformers.test_utils.TestCasePlus"),b6=o(` is best used for such purposes. It\u2019s a sub-class of
`),ed=l("code"),k6=o("unittest.TestCase"),C6=o(", so we can easily inherit from it in the test modules."),H1=f(),on=l("p"),j6=o("Here is an example of its usage:"),z1=f(),d(Yl.$$.fragment),R1=f(),Bs=l("p"),x6=o("This code creates a unique temporary directory, and sets "),td=l("code"),P6=o("tmp_dir"),O6=o(" to its location."),G1=f(),rn=l("ul"),sd=l("li"),I6=o("Create a unique temporary dir:"),F1=f(),d(Vl.$$.fragment),M1=f(),Xl=l("p"),od=l("code"),T6=o("tmp_dir"),A6=o(` will contain the path to the created temporary dir. It will be automatically removed at the end of the
test.`),W1=f(),ln=l("ul"),rd=l("li"),D6=o("Create a temporary dir of my choice, ensure it\u2019s empty before the test starts and don\u2019t empty it after the test."),B1=f(),d(Jl.$$.fragment),Y1=f(),an=l("p"),q6=o(`This is useful for debug when you want to monitor a specific directory and want to make sure the previous tests didn\u2019t
leave any data in there.`),V1=f(),nn=l("ul"),Zl=l("li"),kt=l("p"),S6=o("You can override the default behavior by directly overriding the "),ld=l("code"),L6=o("before"),U6=o(" and "),ad=l("code"),N6=o("after"),H6=o(` args, leading to one of the
following behaviors:`),z6=f(),ve=l("ul"),pn=l("li"),id=l("code"),R6=o("before=True"),G6=o(": the temporary dir will always be cleared at the beginning of the test."),F6=f(),fn=l("li"),nd=l("code"),M6=o("before=False"),W6=o(": if the temporary dir already existed, any existing files will remain there."),B6=f(),hn=l("li"),pd=l("code"),Y6=o("after=True"),V6=o(": the temporary dir will always be deleted at the end of the test."),X6=f(),un=l("li"),fd=l("code"),J6=o("after=False"),Z6=o(": the temporary dir will always be left intact at the end of the test."),X1=f(),d(Ys.$$.fragment),J1=f(),d(Vs.$$.fragment),Z1=f(),Ct=l("h3"),Xs=l("a"),hd=l("span"),d(Kl.$$.fragment),K6=f(),ud=l("span"),Q6=o("Temporary sys.path override"),K1=f(),Le=l("p"),e7=o("If you need to temporary override "),dd=l("code"),t7=o("sys.path"),s7=o(` to import from another test for example, you can use the
`),cd=l("code"),o7=o("ExtendSysPath"),r7=o(" context manager. Example:"),Q1=f(),d(Ql.$$.fragment),ew=f(),jt=l("h3"),Js=l("a"),md=l("span"),d(ea.$$.fragment),l7=f(),_d=l("span"),a7=o("Skipping tests"),tw=f(),Zs=l("p"),i7=o(`This is useful when a bug is found and a new test is written, yet the bug is not fixed yet. In order to be able to
commit it to the main repository we need make sure it\u2019s skipped during `),vd=l("code"),n7=o("make test"),p7=o("."),sw=f(),dn=l("p"),f7=o("Methods:"),ow=f(),Ks=l("ul"),wd=l("li"),ta=l("p"),h7=o("A "),yd=l("strong"),u7=o("skip"),d7=o(` means that you expect your test to pass only if some conditions are met, otherwise pytest should skip
running the test altogether. Common examples are skipping windows-only tests on non-windows platforms, or skipping
tests that depend on an external resource which is not available at the moment (for example a database).`),c7=f(),$d=l("li"),sa=l("p"),m7=o("A "),Ed=l("strong"),_7=o("xfail"),v7=o(` means that you expect a test to fail for some reason. A common example is a test for a feature not yet
implemented, or a bug not yet fixed. When a test passes despite being expected to fail (marked with
pytest.mark.xfail), it\u2019s an xpass and will be reported in the test summary.`),rw=f(),le=l("p"),w7=o("One of the important differences between the two is that "),gd=l("code"),y7=o("skip"),$7=o(" doesn\u2019t run the test, and "),bd=l("code"),E7=o("xfail"),g7=o(` does. So if the
code that\u2019s buggy causes some bad state that will affect other tests, do not use `),kd=l("code"),b7=o("xfail"),k7=o("."),lw=f(),xt=l("h4"),Qs=l("a"),Cd=l("span"),d(oa.$$.fragment),C7=f(),jd=l("span"),j7=o("Implementation"),aw=f(),cn=l("ul"),xd=l("li"),x7=o("Here is how to skip whole test unconditionally:"),iw=f(),d(ra.$$.fragment),nw=f(),mn=l("p"),P7=o("or via pytest:"),pw=f(),d(la.$$.fragment),fw=f(),eo=l("p"),O7=o("or the "),Pd=l("code"),I7=o("xfail"),T7=o(" way:"),hw=f(),d(aa.$$.fragment),uw=f(),_n=l("ul"),Od=l("li"),A7=o("Here is how to skip a test based on some internal check inside the test:"),dw=f(),d(ia.$$.fragment),cw=f(),vn=l("p"),D7=o("or the whole module:"),mw=f(),d(na.$$.fragment),_w=f(),to=l("p"),q7=o("or the "),Id=l("code"),S7=o("xfail"),L7=o(" way:"),vw=f(),d(pa.$$.fragment),ww=f(),wn=l("ul"),Td=l("li"),U7=o("Here is how to skip all tests in a module if some import is missing:"),yw=f(),d(fa.$$.fragment),$w=f(),yn=l("ul"),Ad=l("li"),N7=o("Skip a test based on a condition:"),Ew=f(),d(ha.$$.fragment),gw=f(),$n=l("p"),H7=o("or:"),bw=f(),d(ua.$$.fragment),kw=f(),En=l("p"),z7=o("or skip the whole module:"),Cw=f(),d(da.$$.fragment),jw=f(),so=l("p"),R7=o("More details, example and ways are "),ca=l("a"),G7=o("here"),F7=o("."),xw=f(),Pt=l("h3"),oo=l("a"),Dd=l("span"),d(ma.$$.fragment),M7=f(),qd=l("span"),W7=o("Slow tests"),Pw=f(),gn=l("p"),B7=o(`The library of tests is ever-growing, and some of the tests take minutes to run, therefore we can\u2019t afford waiting for
an hour for the test suite to complete on CI. Therefore, with some exceptions for essential tests, slow tests should be
marked as in the example below:`),Ow=f(),d(_a.$$.fragment),Iw=f(),Ue=l("p"),Y7=o("Once a test is marked as "),Sd=l("code"),V7=o("@slow"),X7=o(", to run such tests set "),Ld=l("code"),J7=o("RUN_SLOW=1"),Z7=o(" env var, e.g.:"),Tw=f(),d(va.$$.fragment),Aw=f(),ae=l("p"),K7=o("Some decorators like "),Ud=l("code"),Q7=o("@parameterized"),e8=o(" rewrite test names, therefore "),Nd=l("code"),t8=o("@slow"),s8=o(` and the rest of the skip decorators
`),Hd=l("code"),o8=o("@require_*"),r8=o(" have to be listed last for them to work correctly. Here is an example of the correct usage:"),Dw=f(),d(wa.$$.fragment),qw=f(),bn=l("p"),l8=o(`As explained at the beginning of this document, slow tests get to run on a scheduled basis, rather than in PRs CI
checks. So it\u2019s possible that some problems will be missed during a PR submission and get merged. Such problems will
get caught during the next scheduled CI job. But it also means that it\u2019s important to run the slow tests on your
machine before submitting the PR.`),Sw=f(),kn=l("p"),a8=o("Here is a rough decision making mechanism for choosing which tests should be marked as slow:"),Lw=f(),Cn=l("p"),i8=o(`If the test is focused on one of the library\u2019s internal components (e.g., modeling files, tokenization files,
pipelines), then we should run that test in the non-slow test suite. If it\u2019s focused on an other aspect of the library,
such as the documentation or the examples, then we should run these tests in the slow test suite. And then, to refine
this approach we should have exceptions:`),Uw=f(),ie=l("ul"),zd=l("li"),n8=o(`All tests that need to download a heavy set of weights or a dataset that is larger than ~50MB (e.g., model or
tokenizer integration tests, pipeline integration tests) should be set to slow. If you\u2019re adding a new model, you
should create and upload to the hub a tiny version of it (with random weights) for integration tests. This is
discussed in the following paragraphs.`),p8=f(),Rd=l("li"),f8=o("All tests that need to do a training not specifically optimized to be fast should be set to slow."),h8=f(),Ot=l("li"),u8=o(`We can introduce exceptions if some of these should-be-non-slow tests are excruciatingly slow, and set them to
`),Gd=l("code"),d8=o("@slow"),c8=o(`. Auto-modeling tests, which save and load large files to disk, are a good example of tests that are marked
as `),Fd=l("code"),m8=o("@slow"),_8=o("."),v8=f(),Md=l("li"),w8=o("If a test completes under 1 second on CI (including downloads if any) then it should be a normal test regardless."),Nw=f(),Ne=l("p"),y8=o(`Collectively, all the non-slow tests need to cover entirely the different internals, while remaining fast. For example,
a significant coverage can be achieved by testing with specially created tiny models with random weights. Such models
have the very minimal number of layers (e.g., 2), vocab size (e.g., 1000), etc. Then the `),Wd=l("code"),$8=o("@slow"),E8=o(` tests can use large
slow models to do qualitative testing. To see the use of these simply look for `),Bd=l("em"),g8=o("tiny"),b8=o(" models with:"),Hw=f(),d(ya.$$.fragment),zw=f(),He=l("p"),k8=o("Here is a an example of a "),$a=l("a"),C8=o("script"),j8=o(` that created the tiny model
`),Ea=l("a"),x8=o("stas/tiny-wmt19-en-de"),P8=o(`. You can easily adjust it to your specific
model\u2019s architecture.`),Rw=f(),ro=l("p"),O8=o(`It\u2019s easy to measure the run-time incorrectly if for example there is an overheard of downloading a huge model, but if
you test it locally the downloaded files would be cached and thus the download time not measured. Hence check the
execution speed report in CI logs instead (the output of `),Yd=l("code"),I8=o("pytest --durations=0 tests"),T8=o(")."),Gw=f(),jn=l("p"),A8=o(`That report is also useful to find slow outliers that aren\u2019t marked as such, or which need to be re-written to be fast.
If you notice that the test suite starts getting slow on CI, the top listing of this report will show the slowest
tests.`),Fw=f(),It=l("h3"),lo=l("a"),Vd=l("span"),d(ga.$$.fragment),D8=f(),Xd=l("span"),q8=o("Testing the stdout/stderr output"),Mw=f(),V=l("p"),S8=o("In order to test functions that write to "),Jd=l("code"),L8=o("stdout"),U8=o(" and/or "),Zd=l("code"),N8=o("stderr"),H8=o(`, the test can access those streams using the
`),Kd=l("code"),z8=o("pytest"),R8=o("\u2019s "),ba=l("a"),G8=o("capsys system"),F8=o(". Here is how this is accomplished:"),Ww=f(),d(ka.$$.fragment),Bw=f(),ao=l("p"),M8=o("And, of course, most of the time, "),Qd=l("code"),W8=o("stderr"),B8=o(` will come as a part of an exception, so try/except has to be used in such
a case:`),Yw=f(),d(Ca.$$.fragment),Vw=f(),io=l("p"),Y8=o("Another approach to capturing stdout is via "),ec=l("code"),V8=o("contextlib.redirect_stdout"),X8=o(":"),Xw=f(),d(ja.$$.fragment),Jw=f(),T=l("p"),J8=o("An important potential issue with capturing stdout is that it may contain "),tc=l("code"),Z8=o("\\r"),K8=o(" characters that in normal "),sc=l("code"),Q8=o("print"),e9=o(`
reset everything that has been printed so far. There is no problem with `),oc=l("code"),t9=o("pytest"),s9=o(", but with "),rc=l("code"),o9=o("pytest -s"),r9=o(` these
characters get included in the buffer, so to be able to have the test run with and without `),lc=l("code"),l9=o("-s"),a9=o(`, you have to make an
extra cleanup to the captured output, using `),ac=l("code"),i9=o("re.sub(r'~.*\\r', '', buf, 0, re.M)"),n9=o("."),Zw=f(),no=l("p"),p9=o(`But, then we have a helper context manager wrapper to automatically take care of it all, regardless of whether it has
some `),ic=l("code"),f9=o("\\r"),h9=o("\u2019s in it or not, so it\u2019s a simple:"),Kw=f(),d(xa.$$.fragment),Qw=f(),xn=l("p"),u9=o("Here is a full test example:"),ey=f(),d(Pa.$$.fragment),ty=f(),ze=l("p"),d9=o("If you\u2019d like to capture "),nc=l("code"),c9=o("stderr"),m9=o(" use the "),pc=l("code"),_9=o("CaptureStderr"),v9=o(" class instead:"),sy=f(),d(Oa.$$.fragment),oy=f(),po=l("p"),w9=o("If you need to capture both streams at once, use the parent "),fc=l("code"),y9=o("CaptureStd"),$9=o(" class:"),ry=f(),d(Ia.$$.fragment),ly=f(),Pn=l("p"),E9=o(`Also, to aid debugging test issues, by default these context managers automatically replay the captured streams on exit
from the context.`),ay=f(),Tt=l("h3"),fo=l("a"),hc=l("span"),d(Ta.$$.fragment),g9=f(),uc=l("span"),b9=o("Capturing logger stream"),iy=f(),ho=l("p"),k9=o("If you need to validate the output of a logger, you can use "),dc=l("code"),C9=o("CaptureLogger"),j9=o(":"),ny=f(),d(Aa.$$.fragment),py=f(),At=l("h3"),uo=l("a"),cc=l("span"),d(Da.$$.fragment),x9=f(),mc=l("span"),P9=o("Testing with environment variables"),fy=f(),qa=l("p"),O9=o(`If you want to test the impact of environment variables for a specific test you can use a helper decorator
`),_c=l("code"),I9=o("transformers.testing_utils.mockenv"),hy=f(),d(Sa.$$.fragment),uy=f(),ne=l("p"),T9=o("At times an external program needs to be called, which requires setting "),vc=l("code"),A9=o("PYTHONPATH"),D9=o(" in "),wc=l("code"),q9=o("os.environ"),S9=o(` to include
multiple local paths. A helper class `),yc=l("code"),L9=o("transformers.test_utils.TestCasePlus"),U9=o(" comes to help:"),dy=f(),d(La.$$.fragment),cy=f(),N=l("p"),N9=o("Depending on whether the test file was under the "),$c=l("code"),H9=o("tests"),z9=o(" test suite or "),Ec=l("code"),R9=o("examples"),G9=o(` it\u2019ll correctly set up
`),gc=l("code"),F9=o("env[PYTHONPATH]"),M9=o(" to include one of these two directories, and also the "),bc=l("code"),W9=o("src"),B9=o(` directory to ensure the testing is
done against the current repo, and finally with whatever `),kc=l("code"),Y9=o("env[PYTHONPATH]"),V9=o(` was already set to before the test was
called if anything.`),my=f(),co=l("p"),X9=o("This helper method creates a copy of the "),Cc=l("code"),J9=o("os.environ"),Z9=o(" object, so the original remains intact."),_y=f(),Dt=l("h3"),mo=l("a"),jc=l("span"),d(Ua.$$.fragment),K9=f(),xc=l("span"),Q9=o("Getting reproducible results"),vy=f(),On=l("p"),eC=o(`In some situations you may want to remove randomness for your tests. To get identical reproducable results set, you
will need to fix the seed:`),wy=f(),d(Na.$$.fragment),yy=f(),qt=l("h3"),_o=l("a"),Pc=l("span"),d(Ha.$$.fragment),tC=f(),Oc=l("span"),sC=o("Debugging tests"),$y=f(),In=l("p"),oC=o("To start a debugger at the point of the warning, do this:"),Ey=f(),d(za.$$.fragment),gy=f(),St=l("h2"),vo=l("a"),Ic=l("span"),d(Ra.$$.fragment),rC=f(),Tc=l("span"),lC=o("Working with github actions workflows"),by=f(),Tn=l("p"),aC=o("To trigger a self-push workflow CI job, you must:"),ky=f(),pe=l("ol"),Ga=l("li"),iC=o("Create a new branch on "),Ac=l("code"),nC=o("transformers"),pC=o(" origin (not a fork!)."),fC=f(),H=l("li"),hC=o("The branch name has to start with either "),Dc=l("code"),uC=o("ci_"),dC=o(" or "),qc=l("code"),cC=o("ci-"),mC=o(" ("),Sc=l("code"),_C=o("main"),vC=o(` triggers it too, but we can\u2019t do PRs on
`),Lc=l("code"),wC=o("main"),yC=o(`). It also gets triggered only for specific paths - you can find the up-to-date definition in case it
changed since this document has been written `),Fa=l("a"),$C=o("here"),EC=o(" under "),Uc=l("em"),gC=o("push:"),bC=f(),Nc=l("li"),kC=o("Create a PR from this branch."),CC=f(),Ma=l("li"),jC=o("Then you can see the job appear "),Wa=l("a"),xC=o("here"),PC=o(`. It may not run right away if there
is a backlog.`),Cy=f(),Lt=l("h2"),wo=l("a"),Hc=l("span"),d(Ba.$$.fragment),OC=f(),zc=l("span"),IC=o("Testing Experimental CI Features"),jy=f(),An=l("p"),TC=o(`Testing CI features can be potentially problematic as it can interfere with the normal CI functioning. Therefore if a
new CI feature is to be added, it should be done as following.`),xy=f(),fe=l("ol"),Rc=l("li"),AC=o("Create a new dedicated job that tests what needs to be tested"),DC=f(),Gc=l("li"),qC=o("The new job must always succeed so that it gives us a green \u2713 (details below)."),SC=f(),Fc=l("li"),LC=o(`Let it run for some days to see that a variety of different PR types get to run on it (user fork branches,
non-forked branches, branches originating from github.com UI direct file edit, various forced pushes, etc. - there
are so many) while monitoring the experimental job\u2019s logs (not the overall job green as it\u2019s purposefully always
green)`),UC=f(),Mc=l("li"),NC=o("When it\u2019s clear that everything is solid, then merge the new changes into existing jobs."),Py=f(),Dn=l("p"),HC=o("That way experiments on CI functionality itself won\u2019t interfere with the normal workflow."),Oy=f(),qn=l("p"),zC=o("Now how can we make the job always succeed while the new CI feature is being developed?"),Iy=f(),Sn=l("p"),RC=o(`Some CIs, like TravisCI support ignore-step-failure and will report the overall job as successful, but CircleCI and
Github Actions as of this writing don\u2019t support that.`),Ty=f(),Ln=l("p"),GC=o("So the following workaround can be used:"),Ay=f(),yo=l("ol"),Un=l("li"),Wc=l("code"),FC=o("set +euo pipefail"),MC=o(" at the beginning of the run command to suppress most potential failures in the bash script."),WC=f(),Ut=l("li"),BC=o("the last command must be a success: "),Bc=l("code"),YC=o('echo "done"'),VC=o(" or just "),Yc=l("code"),XC=o("true"),JC=o(" will do"),Dy=f(),Nn=l("p"),ZC=o("Here is an example:"),qy=f(),d(Ya.$$.fragment),Sy=f(),Hn=l("p"),KC=o("For simple commands you could also do:"),Ly=f(),d(Va.$$.fragment),Uy=f(),$o=l("p"),QC=o(`Of course, once satisfied with the results, integrate the experimental step or job with the rest of the normal jobs,
while removing `),Vc=l("code"),ej=o("set +euo pipefail"),tj=o(` or any other things you may have added to ensure that the experimental job doesn\u2019t
interfere with the normal CI functioning.`),Ny=f(),Eo=l("p"),sj=o("This whole process would have been much easier if we only could set something like "),Xc=l("code"),oj=o("allow-failure"),rj=o(` for the
experimental step, and let it fail without impacting the overall status of PRs. But as mentioned earlier CircleCI and
Github Actions don\u2019t support it at the moment.`),Hy=f(),zn=l("p"),lj=o("You can vote for this feature and see where it is at these CI-specific threads:"),zy=f(),go=l("ul"),Jc=l("li"),Xa=l("a"),aj=o("Github Actions:"),ij=f(),Zc=l("li"),Ja=l("a"),nj=o("CircleCI:"),this.h()},l(e){const n=lS('[data-svelte="svelte-1phssyn"]',document.head);$=a(n,"META",{name:!0,content:!0}),n.forEach(s),O=h(e),g=a(e,"H1",{class:!0});var Za=i(g);C=a(Za,"A",{id:!0,class:!0,href:!0});var Kc=i(C);A=a(Kc,"SPAN",{});var Qc=i(A);c(j.$$.fragment,Qc),Qc.forEach(s),Kc.forEach(s),z=h(Za),D=a(Za,"SPAN",{});var em=i(D);P=r(em,"Testing"),em.forEach(s),Za.forEach(s),b=h(e),S=a(e,"P",{});var Tj=i(S);R=r(Tj,"Let\u2019s take a look at how \u{1F917} Transformers models are tested and how you can write new tests and improve the existing ones."),Tj.forEach(s),Nt=h(e),ye=a(e,"P",{});var Aj=i(ye);Be=r(Aj,"There are 2 test suites in the repository:"),Aj.forEach(s),q=h(e),me=a(e,"OL",{});var Gy=i(me);Ye=a(Gy,"LI",{});var pj=i(Ye);Ht=a(pj,"CODE",{});var Dj=i(Ht);ti=r(Dj,"tests"),Dj.forEach(s),OE=r(pj," \u2014 tests for the general API"),pj.forEach(s),IE=h(Gy),si=a(Gy,"LI",{});var fj=i(si);fp=a(fj,"CODE",{});var qj=i(fp);TE=r(qj,"examples"),qj.forEach(s),AE=r(fj," \u2014 tests primarily for various applications that aren\u2019t part of the API"),fj.forEach(s),Gy.forEach(s),fm=h(e),Ve=a(e,"H2",{class:!0});var Fy=i(Ve);zt=a(Fy,"A",{id:!0,class:!0,href:!0});var Sj=i(zt);hp=a(Sj,"SPAN",{});var Lj=i(hp);c(Lo.$$.fragment,Lj),Lj.forEach(s),Sj.forEach(s),DE=h(Fy),up=a(Fy,"SPAN",{});var Uj=i(up);qE=r(Uj,"How transformers are tested"),Uj.forEach(s),Fy.forEach(s),hm=h(e),Rt=a(e,"OL",{});var My=i(Rt);Uo=a(My,"LI",{});var Wy=i(Uo);No=a(Wy,"P",{});var By=i(No);SE=r(By,`Once a PR is submitted it gets tested with 9 CircleCi jobs. Every new commit to that PR gets retested. These jobs
are defined in this `),Ho=a(By,"A",{href:!0,rel:!0});var Nj=i(Ho);LE=r(Nj,"config file"),Nj.forEach(s),UE=r(By,`, so that if needed you can reproduce the same
environment on your machine.`),By.forEach(s),NE=h(Wy),zo=a(Wy,"P",{});var Yy=i(zo);HE=r(Yy,"These CI jobs don\u2019t run "),dp=a(Yy,"CODE",{});var Hj=i(dp);zE=r(Hj,"@slow"),Hj.forEach(s),RE=r(Yy," tests."),Yy.forEach(s),Wy.forEach(s),GE=h(My),Ro=a(My,"LI",{});var Vy=i(Ro);Go=a(Vy,"P",{});var Xy=i(Go);FE=r(Xy,"There are 3 jobs run by "),Fo=a(Xy,"A",{href:!0,rel:!0});var zj=i(Fo);ME=r(zj,"github actions"),zj.forEach(s),WE=r(Xy,":"),Xy.forEach(s),BE=h(Vy),Xe=a(Vy,"UL",{});var Rn=i(Xe);cp=a(Rn,"LI",{});var Rj=i(cp);oi=a(Rj,"P",{});var hj=i(oi);Mo=a(hj,"A",{href:!0,rel:!0});var Gj=i(Mo);YE=r(Gj,"torch hub integration"),Gj.forEach(s),VE=r(hj,`: checks whether torch hub
integration works.`),hj.forEach(s),Rj.forEach(s),XE=h(Rn),mp=a(Rn,"LI",{});var Fj=i(mp);L=a(Fj,"P",{});var Z=i(L);Wo=a(Z,"A",{href:!0,rel:!0});var Mj=i(Wo);JE=r(Mj,"self-hosted (push)"),Mj.forEach(s),ZE=r(Z,`: runs fast tests on GPU only on commits on
`),_p=a(Z,"CODE",{});var Wj=i(_p);KE=r(Wj,"main"),Wj.forEach(s),QE=r(Z,". It only runs if a commit on "),vp=a(Z,"CODE",{});var Bj=i(vp);eg=r(Bj,"main"),Bj.forEach(s),tg=r(Z," has updated the code in one of the following folders: "),wp=a(Z,"CODE",{});var Yj=i(wp);sg=r(Yj,"src"),Yj.forEach(s),og=r(Z,`,
`),yp=a(Z,"CODE",{});var Vj=i(yp);rg=r(Vj,"tests"),Vj.forEach(s),lg=r(Z,", "),$p=a(Z,"CODE",{});var Xj=i($p);ag=r(Xj,".github"),Xj.forEach(s),ig=r(Z," (to prevent running on added model cards, notebooks, etc.)"),Z.forEach(s),Fj.forEach(s),ng=h(Rn),Ep=a(Rn,"LI",{});var Jj=i(Ep);$e=a(Jj,"P",{});var Ka=i($e);Bo=a(Ka,"A",{href:!0,rel:!0});var Zj=i(Bo);pg=r(Zj,"self-hosted runner"),Zj.forEach(s),fg=r(Ka,`: runs normal and slow tests on GPU in
`),gp=a(Ka,"CODE",{});var Kj=i(gp);hg=r(Kj,"tests"),Kj.forEach(s),ug=r(Ka," and "),bp=a(Ka,"CODE",{});var Qj=i(bp);dg=r(Qj,"examples"),Qj.forEach(s),cg=r(Ka,":"),Ka.forEach(s),Jj.forEach(s),Rn.forEach(s),Vy.forEach(s),My.forEach(s),um=h(e),c(Yo.$$.fragment,e),dm=h(e),Gt=a(e,"P",{});var Jy=i(Gt);mg=r(Jy,"The results can be observed "),Vo=a(Jy,"A",{href:!0,rel:!0});var ex=i(Vo);_g=r(ex,"here"),ex.forEach(s),vg=r(Jy,"."),Jy.forEach(s),cm=h(e),Je=a(e,"H2",{class:!0});var Zy=i(Je);Ft=a(Zy,"A",{id:!0,class:!0,href:!0});var tx=i(Ft);kp=a(tx,"SPAN",{});var sx=i(kp);c(Xo.$$.fragment,sx),sx.forEach(s),tx.forEach(s),wg=h(Zy),Cp=a(Zy,"SPAN",{});var ox=i(Cp);yg=r(ox,"Running tests"),ox.forEach(s),Zy.forEach(s),mm=h(e),Ze=a(e,"H3",{class:!0});var Ky=i(Ze);Mt=a(Ky,"A",{id:!0,class:!0,href:!0});var rx=i(Mt);jp=a(rx,"SPAN",{});var lx=i(jp);c(Jo.$$.fragment,lx),lx.forEach(s),rx.forEach(s),$g=h(Ky),xp=a(Ky,"SPAN",{});var ax=i(xp);Eg=r(ax,"Choosing which tests to run"),ax.forEach(s),Ky.forEach(s),_m=h(e),Wt=a(e,"P",{});var Qy=i(Wt);gg=r(Qy,`This document goes into many details of how tests can be run. If after reading everything, you need even more details
you will find them `),Zo=a(Qy,"A",{href:!0,rel:!0});var ix=i(Zo);bg=r(ix,"here"),ix.forEach(s),kg=r(Qy,"."),Qy.forEach(s),vm=h(e),ri=a(e,"P",{});var nx=i(ri);Cg=r(nx,"Here are some most useful ways of running tests."),nx.forEach(s),wm=h(e),li=a(e,"P",{});var px=i(li);jg=r(px,"Run all:"),px.forEach(s),ym=h(e),c(Ko.$$.fragment,e),$m=h(e),ai=a(e,"P",{});var fx=i(ai);xg=r(fx,"or:"),fx.forEach(s),Em=h(e),c(Qo.$$.fragment,e),gm=h(e),ii=a(e,"P",{});var hx=i(ii);Pg=r(hx,"Note that the latter is defined as:"),hx.forEach(s),bm=h(e),c(er.$$.fragment,e),km=h(e),ni=a(e,"P",{});var ux=i(ni);Og=r(ux,"which tells pytest to:"),ux.forEach(s),Cm=h(e),Q=a(e,"UL",{});var bo=i(Q);Pp=a(bo,"LI",{});var dx=i(Pp);Ig=r(dx,"run as many test processes as they are CPU cores (which could be too many if you don\u2019t have a ton of RAM!)"),dx.forEach(s),Tg=h(bo),Op=a(bo,"LI",{});var cx=i(Op);Ag=r(cx,"ensure that all tests from the same file will be run by the same test process"),cx.forEach(s),Dg=h(bo),Ip=a(bo,"LI",{});var mx=i(Ip);qg=r(mx,"do not capture output"),mx.forEach(s),Sg=h(bo),Tp=a(bo,"LI",{});var _x=i(Tp);Lg=r(_x,"run in verbose mode"),_x.forEach(s),bo.forEach(s),jm=h(e),Ke=a(e,"H3",{class:!0});var e$=i(Ke);Bt=a(e$,"A",{id:!0,class:!0,href:!0});var vx=i(Bt);Ap=a(vx,"SPAN",{});var wx=i(Ap);c(tr.$$.fragment,wx),wx.forEach(s),vx.forEach(s),Ug=h(e$),Dp=a(e$,"SPAN",{});var yx=i(Dp);Ng=r(yx,"Getting the list of all tests"),yx.forEach(s),e$.forEach(s),xm=h(e),pi=a(e,"P",{});var $x=i(pi);Hg=r($x,"All tests of the test suite:"),$x.forEach(s),Pm=h(e),c(sr.$$.fragment,e),Om=h(e),fi=a(e,"P",{});var Ex=i(fi);zg=r(Ex,"All tests of a given test file:"),Ex.forEach(s),Im=h(e),c(or.$$.fragment,e),Tm=h(e),Qe=a(e,"H3",{class:!0});var t$=i(Qe);Yt=a(t$,"A",{id:!0,class:!0,href:!0});var gx=i(Yt);qp=a(gx,"SPAN",{});var bx=i(qp);c(rr.$$.fragment,bx),bx.forEach(s),gx.forEach(s),Rg=h(t$),Sp=a(t$,"SPAN",{});var kx=i(Sp);Gg=r(kx,"Run a specific test module"),kx.forEach(s),t$.forEach(s),Am=h(e),hi=a(e,"P",{});var Cx=i(hi);Fg=r(Cx,"To run an individual test module:"),Cx.forEach(s),Dm=h(e),c(lr.$$.fragment,e),qm=h(e),et=a(e,"H3",{class:!0});var s$=i(et);Vt=a(s$,"A",{id:!0,class:!0,href:!0});var jx=i(Vt);Lp=a(jx,"SPAN",{});var xx=i(Lp);c(ar.$$.fragment,xx),xx.forEach(s),jx.forEach(s),Mg=h(s$),Up=a(s$,"SPAN",{});var Px=i(Up);Wg=r(Px,"Run specific tests"),Px.forEach(s),s$.forEach(s),Sm=h(e),ui=a(e,"P",{});var Ox=i(ui);Bg=r(Ox,`Since unittest is used inside most of the tests, to run specific subtests you need to know the name of the unittest
class containing those tests. For example, it could be:`),Ox.forEach(s),Lm=h(e),c(ir.$$.fragment,e),Um=h(e),di=a(e,"P",{});var Ix=i(di);Yg=r(Ix,"Here:"),Ix.forEach(s),Nm=h(e),Ee=a(e,"UL",{});var Gn=i(Ee);ci=a(Gn,"LI",{});var uj=i(ci);Np=a(uj,"CODE",{});var Tx=i(Np);Vg=r(Tx,"tests/test_optimization.py"),Tx.forEach(s),Xg=r(uj," - the file with tests"),uj.forEach(s),Jg=h(Gn),mi=a(Gn,"LI",{});var dj=i(mi);Hp=a(dj,"CODE",{});var Ax=i(Hp);Zg=r(Ax,"OptimizationTest"),Ax.forEach(s),Kg=r(dj," - the name of the class"),dj.forEach(s),Qg=h(Gn),_i=a(Gn,"LI",{});var cj=i(_i);zp=a(cj,"CODE",{});var Dx=i(zp);eb=r(Dx,"test_adam_w"),Dx.forEach(s),tb=r(cj," - the name of the specific test function"),cj.forEach(s),Gn.forEach(s),Hm=h(e),vi=a(e,"P",{});var qx=i(vi);sb=r(qx,"If the file contains multiple classes, you can choose to run only tests of a given class. For example:"),qx.forEach(s),zm=h(e),c(nr.$$.fragment,e),Rm=h(e),wi=a(e,"P",{});var Sx=i(wi);ob=r(Sx,"will run all the tests inside that class."),Sx.forEach(s),Gm=h(e),Xt=a(e,"P",{});var o$=i(Xt);rb=r(o$,"As mentioned earlier you can see what tests are contained inside the "),Rp=a(o$,"CODE",{});var Lx=i(Rp);lb=r(Lx,"OptimizationTest"),Lx.forEach(s),ab=r(o$," class by running:"),o$.forEach(s),Fm=h(e),c(pr.$$.fragment,e),Mm=h(e),yi=a(e,"P",{});var Ux=i(yi);ib=r(Ux,"You can run tests by keyword expressions."),Ux.forEach(s),Wm=h(e),Jt=a(e,"P",{});var r$=i(Jt);nb=r(r$,"To run only tests whose name contains "),Gp=a(r$,"CODE",{});var Nx=i(Gp);pb=r(Nx,"adam"),Nx.forEach(s),fb=r(r$,":"),r$.forEach(s),Bm=h(e),c(fr.$$.fragment,e),Ym=h(e),ee=a(e,"P",{});var ko=i(ee);hb=r(ko,"Logical "),Fp=a(ko,"CODE",{});var Hx=i(Fp);ub=r(Hx,"and"),Hx.forEach(s),db=r(ko," and "),Mp=a(ko,"CODE",{});var zx=i(Mp);cb=r(zx,"or"),zx.forEach(s),mb=r(ko," can be used to indicate whether all keywords should match or either. "),Wp=a(ko,"CODE",{});var Rx=i(Wp);_b=r(Rx,"not"),Rx.forEach(s),vb=r(ko,` can be used to
negate.`),ko.forEach(s),Vm=h(e),Zt=a(e,"P",{});var l$=i(Zt);wb=r(l$,"To run all tests except those whose name contains "),Bp=a(l$,"CODE",{});var Gx=i(Bp);yb=r(Gx,"adam"),Gx.forEach(s),$b=r(l$,":"),l$.forEach(s),Xm=h(e),c(hr.$$.fragment,e),Jm=h(e),$i=a(e,"P",{});var Fx=i($i);Eb=r(Fx,"And you can combine the two patterns in one:"),Fx.forEach(s),Zm=h(e),c(ur.$$.fragment,e),Km=h(e),ge=a(e,"P",{});var Fn=i(ge);gb=r(Fn,"For example to run both "),Yp=a(Fn,"CODE",{});var Mx=i(Yp);bb=r(Mx,"test_adafactor"),Mx.forEach(s),kb=r(Fn," and "),Vp=a(Fn,"CODE",{});var Wx=i(Vp);Cb=r(Wx,"test_adam_w"),Wx.forEach(s),jb=r(Fn," you can use:"),Fn.forEach(s),Qm=h(e),c(dr.$$.fragment,e),e_=h(e),Kt=a(e,"P",{});var a$=i(Kt);xb=r(a$,"Note that we use "),Xp=a(a$,"CODE",{});var Bx=i(Xp);Pb=r(Bx,"or"),Bx.forEach(s),Ob=r(a$," here, since we want either of the keywords to match to include both."),a$.forEach(s),t_=h(e),Qt=a(e,"P",{});var i$=i(Qt);Ib=r(i$,"If you want to include only tests that include both patterns, "),Jp=a(i$,"CODE",{});var Yx=i(Jp);Tb=r(Yx,"and"),Yx.forEach(s),Ab=r(i$," is to be used:"),i$.forEach(s),s_=h(e),c(cr.$$.fragment,e),o_=h(e),tt=a(e,"H3",{class:!0});var n$=i(tt);es=a(n$,"A",{id:!0,class:!0,href:!0});var Vx=i(es);Zp=a(Vx,"SPAN",{});var Xx=i(Zp);c(mr.$$.fragment,Xx),Xx.forEach(s),Vx.forEach(s),Db=h(n$),Kp=a(n$,"SPAN",{});var Jx=i(Kp);qb=r(Jx,"Run only modified tests"),Jx.forEach(s),n$.forEach(s),r_=h(e),ts=a(e,"P",{});var p$=i(ts);Sb=r(p$,"You can run the tests related to the unstaged files or the current branch (according to Git) by using "),_r=a(p$,"A",{href:!0,rel:!0});var Zx=i(_r);Lb=r(Zx,"pytest-picked"),Zx.forEach(s),Ub=r(p$,`. This is a great way of quickly testing your changes didn\u2019t break
anything, since it won\u2019t run the tests related to files you didn\u2019t touch.`),p$.forEach(s),l_=h(e),c(vr.$$.fragment,e),a_=h(e),c(wr.$$.fragment,e),i_=h(e),Ei=a(e,"P",{});var Kx=i(Ei);Nb=r(Kx,"All tests will be run from files and folders which are modified, but not yet committed."),Kx.forEach(s),n_=h(e),st=a(e,"H3",{class:!0});var f$=i(st);ss=a(f$,"A",{id:!0,class:!0,href:!0});var Qx=i(ss);Qp=a(Qx,"SPAN",{});var eP=i(Qp);c(yr.$$.fragment,eP),eP.forEach(s),Qx.forEach(s),Hb=h(f$),ef=a(f$,"SPAN",{});var tP=i(ef);zb=r(tP,"Automatically rerun failed tests on source modification"),tP.forEach(s),f$.forEach(s),p_=h(e),$r=a(e,"P",{});var mj=i($r);Er=a(mj,"A",{href:!0,rel:!0});var sP=i(Er);Rb=r(sP,"pytest-xdist"),sP.forEach(s),Gb=r(mj,` provides a very useful feature of detecting all failed
tests, and then waiting for you to modify files and continuously re-rerun those failing tests until they pass while you
fix them. So that you don\u2019t need to re start pytest after you made the fix. This is repeated until all tests pass after
which again a full run is performed.`),mj.forEach(s),f_=h(e),c(gr.$$.fragment,e),h_=h(e),ot=a(e,"P",{});var tm=i(ot);Fb=r(tm,"To enter the mode: "),tf=a(tm,"CODE",{});var oP=i(tf);Mb=r(oP,"pytest -f"),oP.forEach(s),Wb=r(tm," or "),sf=a(tm,"CODE",{});var rP=i(sf);Bb=r(rP,"pytest --looponfail"),rP.forEach(s),tm.forEach(s),u_=h(e),be=a(e,"P",{});var Mn=i(be);Yb=r(Mn,"File changes are detected by looking at "),of=a(Mn,"CODE",{});var lP=i(of);Vb=r(lP,"looponfailroots"),lP.forEach(s),Xb=r(Mn,` root directories and all of their contents (recursively).
If the default for this value does not work for you, you can change it in your project by setting a configuration
option in `),rf=a(Mn,"CODE",{});var aP=i(rf);Jb=r(aP,"setup.cfg"),aP.forEach(s),Zb=r(Mn,":"),Mn.forEach(s),d_=h(e),c(br.$$.fragment,e),c_=h(e),ke=a(e,"P",{});var Wn=i(ke);Kb=r(Wn,"or "),lf=a(Wn,"CODE",{});var iP=i(lf);Qb=r(iP,"pytest.ini"),iP.forEach(s),e3=r(Wn,"/"),af=a(Wn,"CODE",{});var nP=i(af);t3=r(nP,"tox.ini"),nP.forEach(s),s3=r(Wn," files:"),Wn.forEach(s),m_=h(e),c(kr.$$.fragment,e),__=h(e),gi=a(e,"P",{});var pP=i(gi);o3=r(pP,`This would lead to only looking for file changes in the respective directories, specified relatively to the ini-file\u2019s
directory.`),pP.forEach(s),v_=h(e),Cr=a(e,"P",{});var _j=i(Cr);jr=a(_j,"A",{href:!0,rel:!0});var fP=i(jr);r3=r(fP,"pytest-watch"),fP.forEach(s),l3=r(_j," is an alternative implementation of this functionality."),_j.forEach(s),w_=h(e),rt=a(e,"H3",{class:!0});var h$=i(rt);os=a(h$,"A",{id:!0,class:!0,href:!0});var hP=i(os);nf=a(hP,"SPAN",{});var uP=i(nf);c(xr.$$.fragment,uP),uP.forEach(s),hP.forEach(s),a3=h(h$),pf=a(h$,"SPAN",{});var dP=i(pf);i3=r(dP,"Skip a test module"),dP.forEach(s),h$.forEach(s),y_=h(e),rs=a(e,"P",{});var u$=i(rs);n3=r(u$,`If you want to run all test modules, except a few you can exclude them by giving an explicit list of tests to run. For
example, to run all except `),ff=a(u$,"CODE",{});var cP=i(ff);p3=r(cP,"test_modeling_*.py"),cP.forEach(s),f3=r(u$," tests:"),u$.forEach(s),$_=h(e),c(Pr.$$.fragment,e),E_=h(e),lt=a(e,"H3",{class:!0});var d$=i(lt);ls=a(d$,"A",{id:!0,class:!0,href:!0});var mP=i(ls);hf=a(mP,"SPAN",{});var _P=i(hf);c(Or.$$.fragment,_P),_P.forEach(s),mP.forEach(s),h3=h(d$),uf=a(d$,"SPAN",{});var vP=i(uf);u3=r(vP,"Clearing state"),vP.forEach(s),d$.forEach(s),g_=h(e),bi=a(e,"P",{});var wP=i(bi);d3=r(wP,"CI builds and when isolation is important (against speed), cache should be cleared:"),wP.forEach(s),b_=h(e),c(Ir.$$.fragment,e),k_=h(e),at=a(e,"H3",{class:!0});var c$=i(at);as=a(c$,"A",{id:!0,class:!0,href:!0});var yP=i(as);df=a(yP,"SPAN",{});var $P=i(df);c(Tr.$$.fragment,$P),$P.forEach(s),yP.forEach(s),c3=h(c$),cf=a(c$,"SPAN",{});var EP=i(cf);m3=r(EP,"Running tests in parallel"),EP.forEach(s),c$.forEach(s),C_=h(e),M=a(e,"P",{});var Re=i(M);_3=r(Re,"As mentioned earlier "),mf=a(Re,"CODE",{});var gP=i(mf);v3=r(gP,"make test"),gP.forEach(s),w3=r(Re," runs tests in parallel via "),_f=a(Re,"CODE",{});var bP=i(_f);y3=r(bP,"pytest-xdist"),bP.forEach(s),$3=r(Re," plugin ("),vf=a(Re,"CODE",{});var kP=i(vf);E3=r(kP,"-n X"),kP.forEach(s),g3=r(Re," argument, e.g. "),wf=a(Re,"CODE",{});var CP=i(wf);b3=r(CP,"-n 2"),CP.forEach(s),k3=r(Re,`
to run 2 parallel jobs).`),Re.forEach(s),j_=h(e),_e=a(e,"P",{});var Qa=i(_e);yf=a(Qa,"CODE",{});var jP=i(yf);C3=r(jP,"pytest-xdist"),jP.forEach(s),j3=r(Qa,"\u2019s "),$f=a(Qa,"CODE",{});var xP=i($f);x3=r(xP,"--dist="),xP.forEach(s),P3=r(Qa," option allows one to control how the tests are grouped. "),Ef=a(Qa,"CODE",{});var PP=i(Ef);O3=r(PP,"--dist=loadfile"),PP.forEach(s),I3=r(Qa,` puts the
tests located in one file onto the same process.`),Qa.forEach(s),x_=h(e),Ce=a(e,"P",{});var Bn=i(Ce);T3=r(Bn,"Since the order of executed tests is different and unpredictable, if running the test suite with "),gf=a(Bn,"CODE",{});var OP=i(gf);A3=r(OP,"pytest-xdist"),OP.forEach(s),D3=r(Bn,`
produces failures (meaning we have some undetected coupled tests), use `),Ar=a(Bn,"A",{href:!0,rel:!0});var IP=i(Ar);q3=r(IP,"pytest-replay"),IP.forEach(s),S3=r(Bn,` to replay the tests in the same order, which should help with then somehow
reducing that failing sequence to a minimum.`),Bn.forEach(s),P_=h(e),it=a(e,"H3",{class:!0});var m$=i(it);is=a(m$,"A",{id:!0,class:!0,href:!0});var TP=i(is);bf=a(TP,"SPAN",{});var AP=i(bf);c(Dr.$$.fragment,AP),AP.forEach(s),TP.forEach(s),L3=h(m$),kf=a(m$,"SPAN",{});var DP=i(kf);U3=r(DP,"Test order and repetition"),DP.forEach(s),m$.forEach(s),O_=h(e),ki=a(e,"P",{});var qP=i(ki);N3=r(qP,`It\u2019s good to repeat the tests several times, in sequence, randomly, or in sets, to detect any potential
inter-dependency and state-related bugs (tear down). And the straightforward multiple repetition is just good to detect
some problems that get uncovered by randomness of DL.`),qP.forEach(s),I_=h(e),nt=a(e,"H4",{class:!0});var _$=i(nt);ns=a(_$,"A",{id:!0,class:!0,href:!0});var SP=i(ns);Cf=a(SP,"SPAN",{});var LP=i(Cf);c(qr.$$.fragment,LP),LP.forEach(s),SP.forEach(s),H3=h(_$),jf=a(_$,"SPAN",{});var UP=i(jf);z3=r(UP,"Repeat tests"),UP.forEach(s),_$.forEach(s),T_=h(e),Ci=a(e,"UL",{});var NP=i(Ci);ji=a(NP,"LI",{});var vj=i(ji);Sr=a(vj,"A",{href:!0,rel:!0});var HP=i(Sr);R3=r(HP,"pytest-flakefinder"),HP.forEach(s),G3=r(vj,":"),vj.forEach(s),NP.forEach(s),A_=h(e),c(Lr.$$.fragment,e),D_=h(e),xi=a(e,"P",{});var zP=i(xi);F3=r(zP,"And then run every test multiple times (50 by default):"),zP.forEach(s),q_=h(e),c(Ur.$$.fragment,e),S_=h(e),c(ps.$$.fragment,e),L_=h(e),c(fs.$$.fragment,e),U_=h(e),pt=a(e,"H4",{class:!0});var v$=i(pt);hs=a(v$,"A",{id:!0,class:!0,href:!0});var RP=i(hs);xf=a(RP,"SPAN",{});var GP=i(xf);c(Nr.$$.fragment,GP),GP.forEach(s),RP.forEach(s),M3=h(v$),Pf=a(v$,"SPAN",{});var FP=i(Pf);W3=r(FP,"Run tests in a random order"),FP.forEach(s),v$.forEach(s),N_=h(e),c(Hr.$$.fragment,e),H_=h(e),us=a(e,"P",{});var w$=i(us);B3=r(w$,"Important: the presence of "),Of=a(w$,"CODE",{});var MP=i(Of);Y3=r(MP,"pytest-random-order"),MP.forEach(s),V3=r(w$,` will automatically randomize tests, no configuration change or
command line options is required.`),w$.forEach(s),z_=h(e),ds=a(e,"P",{});var y$=i(ds);X3=r(y$,`As explained earlier this allows detection of coupled tests - where one test\u2019s state affects the state of another. When
`),If=a(y$,"CODE",{});var WP=i(If);J3=r(WP,"pytest-random-order"),WP.forEach(s),Z3=r(y$," is installed it will print the random seed it used for that session, e.g:"),y$.forEach(s),R_=h(e),c(zr.$$.fragment,e),G_=h(e),Pi=a(e,"P",{});var BP=i(Pi);K3=r(BP,"So that if the given particular sequence fails, you can reproduce it by adding that exact seed, e.g.:"),BP.forEach(s),F_=h(e),c(Rr.$$.fragment,e),M_=h(e),cs=a(e,"P",{});var $$=i(cs);Q3=r($$,`It will only reproduce the exact order if you use the exact same list of tests (or no list at all). Once you start to
manually narrowing down the list you can no longer rely on the seed, but have to list them manually in the exact order
they failed and tell pytest to not randomize them instead using `),Tf=a($$,"CODE",{});var YP=i(Tf);e2=r(YP,"--random-order-bucket=none"),YP.forEach(s),t2=r($$,", e.g.:"),$$.forEach(s),W_=h(e),c(Gr.$$.fragment,e),B_=h(e),Oi=a(e,"P",{});var VP=i(Oi);s2=r(VP,"To disable the shuffling for all tests:"),VP.forEach(s),Y_=h(e),c(Fr.$$.fragment,e),V_=h(e),I=a(e,"P",{});var X=i(I);o2=r(X,"By default "),Af=a(X,"CODE",{});var XP=i(Af);r2=r(XP,"--random-order-bucket=module"),XP.forEach(s),l2=r(X,` is implied, which will shuffle the files on the module levels. It can also
shuffle on `),Df=a(X,"CODE",{});var JP=i(Df);a2=r(JP,"class"),JP.forEach(s),i2=r(X,", "),qf=a(X,"CODE",{});var ZP=i(qf);n2=r(ZP,"package"),ZP.forEach(s),p2=r(X,", "),Sf=a(X,"CODE",{});var KP=i(Sf);f2=r(KP,"global"),KP.forEach(s),h2=r(X," and "),Lf=a(X,"CODE",{});var QP=i(Lf);u2=r(QP,"none"),QP.forEach(s),d2=r(X,` levels. For the complete details please see its
`),Mr=a(X,"A",{href:!0,rel:!0});var eO=i(Mr);c2=r(eO,"documentation"),eO.forEach(s),m2=r(X,"."),X.forEach(s),X_=h(e),je=a(e,"P",{});var Yn=i(je);_2=r(Yn,"Another randomization alternative is: "),Wr=a(Yn,"A",{href:!0,rel:!0});var tO=i(Wr);Uf=a(tO,"CODE",{});var sO=i(Uf);v2=r(sO,"pytest-randomly"),sO.forEach(s),tO.forEach(s),w2=r(Yn,`. This
module has a very similar functionality/interface, but it doesn\u2019t have the bucket modes available in
`),Nf=a(Yn,"CODE",{});var oO=i(Nf);y2=r(oO,"pytest-random-order"),oO.forEach(s),$2=r(Yn,". It has the same problem of imposing itself once installed."),Yn.forEach(s),J_=h(e),ft=a(e,"H3",{class:!0});var E$=i(ft);ms=a(E$,"A",{id:!0,class:!0,href:!0});var rO=i(ms);Hf=a(rO,"SPAN",{});var lO=i(Hf);c(Br.$$.fragment,lO),lO.forEach(s),rO.forEach(s),E2=h(E$),zf=a(E$,"SPAN",{});var aO=i(zf);g2=r(aO,"Look and feel variations"),aO.forEach(s),E$.forEach(s),Z_=h(e),ht=a(e,"H4",{class:!0});var g$=i(ht);_s=a(g$,"A",{id:!0,class:!0,href:!0});var iO=i(_s);Rf=a(iO,"SPAN",{});var nO=i(Rf);c(Yr.$$.fragment,nO),nO.forEach(s),iO.forEach(s),b2=h(g$),Gf=a(g$,"SPAN",{});var pO=i(Gf);k2=r(pO,"pytest-sugar"),pO.forEach(s),g$.forEach(s),K_=h(e),Vr=a(e,"P",{});var wj=i(Vr);Xr=a(wj,"A",{href:!0,rel:!0});var fO=i(Xr);C2=r(fO,"pytest-sugar"),fO.forEach(s),j2=r(wj,` is a plugin that improves the look-n-feel, adds a
progressbar, and show tests that fail and the assert instantly. It gets activated automatically upon installation.`),wj.forEach(s),Q_=h(e),c(Jr.$$.fragment,e),ev=h(e),Ii=a(e,"P",{});var hO=i(Ii);x2=r(hO,"To run tests without it, run:"),hO.forEach(s),tv=h(e),c(Zr.$$.fragment,e),sv=h(e),Ti=a(e,"P",{});var uO=i(Ti);P2=r(uO,"or uninstall it."),uO.forEach(s),ov=h(e),ut=a(e,"H4",{class:!0});var b$=i(ut);vs=a(b$,"A",{id:!0,class:!0,href:!0});var dO=i(vs);Ff=a(dO,"SPAN",{});var cO=i(Ff);c(Kr.$$.fragment,cO),cO.forEach(s),dO.forEach(s),O2=h(b$),Mf=a(b$,"SPAN",{});var mO=i(Mf);I2=r(mO,"Report each sub-test name and its progress"),mO.forEach(s),b$.forEach(s),rv=h(e),xe=a(e,"P",{});var Vn=i(xe);T2=r(Vn,"For a single or a group of tests via "),Wf=a(Vn,"CODE",{});var _O=i(Wf);A2=r(_O,"pytest"),_O.forEach(s),D2=r(Vn," (after "),Bf=a(Vn,"CODE",{});var vO=i(Bf);q2=r(vO,"pip install pytest-pspec"),vO.forEach(s),S2=r(Vn,"):"),Vn.forEach(s),lv=h(e),c(Qr.$$.fragment,e),av=h(e),dt=a(e,"H4",{class:!0});var k$=i(dt);ws=a(k$,"A",{id:!0,class:!0,href:!0});var wO=i(ws);Yf=a(wO,"SPAN",{});var yO=i(Yf);c(el.$$.fragment,yO),yO.forEach(s),wO.forEach(s),L2=h(k$),Vf=a(k$,"SPAN",{});var $O=i(Vf);U2=r($O,"Instantly shows failed tests"),$O.forEach(s),k$.forEach(s),iv=h(e),tl=a(e,"P",{});var yj=i(tl);sl=a(yj,"A",{href:!0,rel:!0});var EO=i(sl);N2=r(EO,"pytest-instafail"),EO.forEach(s),H2=r(yj,` shows failures and errors instantly instead of
waiting until the end of test session.`),yj.forEach(s),nv=h(e),c(ol.$$.fragment,e),pv=h(e),c(rl.$$.fragment,e),fv=h(e),ct=a(e,"H3",{class:!0});var C$=i(ct);ys=a(C$,"A",{id:!0,class:!0,href:!0});var gO=i(ys);Xf=a(gO,"SPAN",{});var bO=i(Xf);c(ll.$$.fragment,bO),bO.forEach(s),gO.forEach(s),z2=h(C$),Jf=a(C$,"SPAN",{});var kO=i(Jf);R2=r(kO,"To GPU or not to GPU"),kO.forEach(s),C$.forEach(s),hv=h(e),$s=a(e,"P",{});var j$=i($s);G2=r(j$,"On a GPU-enabled setup, to test in CPU-only mode add "),Zf=a(j$,"CODE",{});var CO=i(Zf);F2=r(CO,'CUDA_VISIBLE_DEVICES=""'),CO.forEach(s),M2=r(j$,":"),j$.forEach(s),uv=h(e),c(al.$$.fragment,e),dv=h(e),te=a(e,"P",{});var Co=i(te);W2=r(Co,"or if you have multiple gpus, you can specify which one is to be used by "),Kf=a(Co,"CODE",{});var jO=i(Kf);B2=r(jO,"pytest"),jO.forEach(s),Y2=r(Co,`. For example, to use only the
second gpu if you have gpus `),Qf=a(Co,"CODE",{});var xO=i(Qf);V2=r(xO,"0"),xO.forEach(s),X2=r(Co," and "),eh=a(Co,"CODE",{});var PO=i(eh);J2=r(PO,"1"),PO.forEach(s),Z2=r(Co,", you can run:"),Co.forEach(s),cv=h(e),c(il.$$.fragment,e),mv=h(e),Ai=a(e,"P",{});var OO=i(Ai);K2=r(OO,"This is handy when you want to run different tasks on different GPUs."),OO.forEach(s),_v=h(e),Di=a(e,"P",{});var IO=i(Di);Q2=r(IO,`Some tests must be run on CPU-only, others on either CPU or GPU or TPU, yet others on multiple-GPUs. The following skip
decorators are used to set the requirements of tests CPU/GPU/TPU-wise:`),IO.forEach(s),vv=h(e),U=a(e,"UL",{});var he=i(U);qi=a(he,"LI",{});var $j=i(qi);th=a($j,"CODE",{});var TO=i(th);e5=r(TO,"require_torch"),TO.forEach(s),t5=r($j," - this test will run only under torch"),$j.forEach(s),s5=h(he),Es=a(he,"LI",{});var sm=i(Es);sh=a(sm,"CODE",{});var AO=i(sh);o5=r(AO,"require_torch_gpu"),AO.forEach(s),r5=r(sm," - as "),oh=a(sm,"CODE",{});var DO=i(oh);l5=r(DO,"require_torch"),DO.forEach(s),a5=r(sm," plus requires at least 1 GPU"),sm.forEach(s),i5=h(he),gs=a(he,"LI",{});var om=i(gs);rh=a(om,"CODE",{});var qO=i(rh);n5=r(qO,"require_torch_multi_gpu"),qO.forEach(s),p5=r(om," - as "),lh=a(om,"CODE",{});var SO=i(lh);f5=r(SO,"require_torch"),SO.forEach(s),h5=r(om," plus requires at least 2 GPUs"),om.forEach(s),u5=h(he),bs=a(he,"LI",{});var rm=i(bs);ah=a(rm,"CODE",{});var LO=i(ah);d5=r(LO,"require_torch_non_multi_gpu"),LO.forEach(s),c5=r(rm," - as "),ih=a(rm,"CODE",{});var UO=i(ih);m5=r(UO,"require_torch"),UO.forEach(s),_5=r(rm," plus requires 0 or 1 GPUs"),rm.forEach(s),v5=h(he),ks=a(he,"LI",{});var lm=i(ks);nh=a(lm,"CODE",{});var NO=i(nh);w5=r(NO,"require_torch_up_to_2_gpus"),NO.forEach(s),y5=r(lm," - as "),ph=a(lm,"CODE",{});var HO=i(ph);$5=r(HO,"require_torch"),HO.forEach(s),E5=r(lm," plus requires 0 or 1 or 2 GPUs"),lm.forEach(s),g5=h(he),Cs=a(he,"LI",{});var am=i(Cs);fh=a(am,"CODE",{});var zO=i(fh);b5=r(zO,"require_torch_tpu"),zO.forEach(s),k5=r(am," - as "),hh=a(am,"CODE",{});var RO=i(hh);C5=r(RO,"require_torch"),RO.forEach(s),j5=r(am," plus requires at least 1 TPU"),am.forEach(s),he.forEach(s),wv=h(e),Si=a(e,"P",{});var GO=i(Si);x5=r(GO,"Let\u2019s depict the GPU requirements in the following table:"),GO.forEach(s),yv=h(e),k=a(e,"P",{});var x=i(k);P5=r(x,`| n gpus | decorator                      |
|--------+--------------------------------|
| `),uh=a(x,"CODE",{});var FO=i(uh);O5=r(FO,">= 0"),FO.forEach(s),I5=r(x," | "),dh=a(x,"CODE",{});var MO=i(dh);T5=r(MO,"@require_torch"),MO.forEach(s),A5=r(x,`               |
| `),ch=a(x,"CODE",{});var WO=i(ch);D5=r(WO,">= 1"),WO.forEach(s),q5=r(x," | "),mh=a(x,"CODE",{});var BO=i(mh);S5=r(BO,"@require_torch_gpu"),BO.forEach(s),L5=r(x,`           |
| `),_h=a(x,"CODE",{});var YO=i(_h);U5=r(YO,">= 2"),YO.forEach(s),N5=r(x," | "),vh=a(x,"CODE",{});var VO=i(vh);H5=r(VO,"@require_torch_multi_gpu"),VO.forEach(s),z5=r(x,`     |
| `),wh=a(x,"CODE",{});var XO=i(wh);R5=r(XO,"< 2"),XO.forEach(s),G5=r(x,"  | "),yh=a(x,"CODE",{});var JO=i(yh);F5=r(JO,"@require_torch_non_multi_gpu"),JO.forEach(s),M5=r(x,` |
| `),$h=a(x,"CODE",{});var ZO=i($h);W5=r(ZO,"< 3"),ZO.forEach(s),B5=r(x,"  | "),Eh=a(x,"CODE",{});var KO=i(Eh);Y5=r(KO,"@require_torch_up_to_2_gpus"),KO.forEach(s),V5=r(x,"  |"),x.forEach(s),$v=h(e),Li=a(e,"P",{});var QO=i(Li);X5=r(QO,"For example, here is a test that must be run only when there are 2 or more GPUs available and pytorch is installed:"),QO.forEach(s),Ev=h(e),c(nl.$$.fragment,e),gv=h(e),Pe=a(e,"P",{});var Xn=i(Pe);J5=r(Xn,"If a test requires "),gh=a(Xn,"CODE",{});var eI=i(gh);Z5=r(eI,"tensorflow"),eI.forEach(s),K5=r(Xn," use the "),bh=a(Xn,"CODE",{});var tI=i(bh);Q5=r(tI,"require_tf"),tI.forEach(s),ek=r(Xn," decorator. For example:"),Xn.forEach(s),bv=h(e),c(pl.$$.fragment,e),kv=h(e),Ui=a(e,"P",{});var sI=i(Ui);tk=r(sI,`These decorators can be stacked. For example, if a test is slow and requires at least one GPU under pytorch, here is
how to set it up:`),sI.forEach(s),Cv=h(e),c(fl.$$.fragment,e),jv=h(e),Oe=a(e,"P",{});var Jn=i(Oe);sk=r(Jn,"Some decorators like "),kh=a(Jn,"CODE",{});var oI=i(kh);ok=r(oI,"@parametrized"),oI.forEach(s),rk=r(Jn," rewrite test names, therefore "),Ch=a(Jn,"CODE",{});var rI=i(Ch);lk=r(rI,"@require_*"),rI.forEach(s),ak=r(Jn,` skip decorators have to be listed
last for them to work correctly. Here is an example of the correct usage:`),Jn.forEach(s),xv=h(e),c(hl.$$.fragment,e),Pv=h(e),js=a(e,"P",{});var x$=i(js);ik=r(x$,"This order problem doesn\u2019t exist with "),jh=a(x$,"CODE",{});var lI=i(jh);nk=r(lI,"@pytest.mark.parametrize"),lI.forEach(s),pk=r(x$,`, you can put it first or last and it will still
work. But it only works with non-unittests.`),x$.forEach(s),Ov=h(e),Ni=a(e,"P",{});var aI=i(Ni);fk=r(aI,"Inside tests:"),aI.forEach(s),Iv=h(e),Hi=a(e,"UL",{});var iI=i(Hi);xh=a(iI,"LI",{});var nI=i(xh);hk=r(nI,"How many GPUs are available:"),nI.forEach(s),iI.forEach(s),Tv=h(e),c(ul.$$.fragment,e),Av=h(e),mt=a(e,"H3",{class:!0});var P$=i(mt);xs=a(P$,"A",{id:!0,class:!0,href:!0});var pI=i(xs);Ph=a(pI,"SPAN",{});var fI=i(Ph);c(dl.$$.fragment,fI),fI.forEach(s),pI.forEach(s),uk=h(P$),Oh=a(P$,"SPAN",{});var hI=i(Oh);dk=r(hI,"Distributed training"),hI.forEach(s),P$.forEach(s),Dv=h(e),_t=a(e,"P",{});var im=i(_t);Ih=a(im,"CODE",{});var uI=i(Ih);ck=r(uI,"pytest"),uI.forEach(s),mk=r(im,` can\u2019t deal with distributed training directly. If this is attempted - the sub-processes don\u2019t do the right
thing and end up thinking they are `),Th=a(im,"CODE",{});var dI=i(Th);_k=r(dI,"pytest"),dI.forEach(s),vk=r(im,` and start running the test suite in loops. It works, however, if one
spawns a normal process that then spawns off multiple workers and manages the IO pipes.`),im.forEach(s),qv=h(e),zi=a(e,"P",{});var cI=i(zi);wk=r(cI,"Here are some tests that use it:"),cI.forEach(s),Sv=h(e),Ps=a(e,"UL",{});var O$=i(Ps);Ah=a(O$,"LI",{});var mI=i(Ah);cl=a(mI,"A",{href:!0,rel:!0});var _I=i(cl);yk=r(_I,"test_trainer_distributed.py"),_I.forEach(s),mI.forEach(s),$k=h(O$),Dh=a(O$,"LI",{});var vI=i(Dh);ml=a(vI,"A",{href:!0,rel:!0});var wI=i(ml);Ek=r(wI,"test_deepspeed.py"),wI.forEach(s),vI.forEach(s),O$.forEach(s),Lv=h(e),Os=a(e,"P",{});var I$=i(Os);gk=r(I$,"To jump right into the execution point, search for the "),qh=a(I$,"CODE",{});var yI=i(qh);bk=r(yI,"execute_subprocess_async"),yI.forEach(s),kk=r(I$," call in those tests."),I$.forEach(s),Uv=h(e),Ri=a(e,"P",{});var $I=i(Ri);Ck=r($I,"You will need at least 2 GPUs to see these tests in action:"),$I.forEach(s),Nv=h(e),c(_l.$$.fragment,e),Hv=h(e),vt=a(e,"H3",{class:!0});var T$=i(vt);Is=a(T$,"A",{id:!0,class:!0,href:!0});var EI=i(Is);Sh=a(EI,"SPAN",{});var gI=i(Sh);c(vl.$$.fragment,gI),gI.forEach(s),EI.forEach(s),jk=h(T$),Lh=a(T$,"SPAN",{});var bI=i(Lh);xk=r(bI,"Output capture"),bI.forEach(s),T$.forEach(s),zv=h(e),Ie=a(e,"P",{});var Zn=i(Ie);Pk=r(Zn,"During test execution any output sent to "),Uh=a(Zn,"CODE",{});var kI=i(Uh);Ok=r(kI,"stdout"),kI.forEach(s),Ik=r(Zn," and "),Nh=a(Zn,"CODE",{});var CI=i(Nh);Tk=r(CI,"stderr"),CI.forEach(s),Ak=r(Zn,` is captured. If a test or a setup method fails, its
according captured output will usually be shown along with the failure traceback.`),Zn.forEach(s),Rv=h(e),W=a(e,"P",{});var Ge=i(W);Dk=r(Ge,"To disable output capturing and to get the "),Hh=a(Ge,"CODE",{});var jI=i(Hh);qk=r(jI,"stdout"),jI.forEach(s),Sk=r(Ge," and "),zh=a(Ge,"CODE",{});var xI=i(zh);Lk=r(xI,"stderr"),xI.forEach(s),Uk=r(Ge," normally, use "),Rh=a(Ge,"CODE",{});var PI=i(Rh);Nk=r(PI,"-s"),PI.forEach(s),Hk=r(Ge," or "),Gh=a(Ge,"CODE",{});var OI=i(Gh);zk=r(OI,"--capture=no"),OI.forEach(s),Rk=r(Ge,":"),Ge.forEach(s),Gv=h(e),c(wl.$$.fragment,e),Fv=h(e),Gi=a(e,"P",{});var II=i(Gi);Gk=r(II,"To send test results to JUnit format output:"),II.forEach(s),Mv=h(e),c(yl.$$.fragment,e),Wv=h(e),wt=a(e,"H3",{class:!0});var A$=i(wt);Ts=a(A$,"A",{id:!0,class:!0,href:!0});var TI=i(Ts);Fh=a(TI,"SPAN",{});var AI=i(Fh);c($l.$$.fragment,AI),AI.forEach(s),TI.forEach(s),Fk=h(A$),Mh=a(A$,"SPAN",{});var DI=i(Mh);Mk=r(DI,"Color control"),DI.forEach(s),A$.forEach(s),Bv=h(e),Fi=a(e,"P",{});var qI=i(Fi);Wk=r(qI,"To have no color (e.g., yellow on white background is not readable):"),qI.forEach(s),Yv=h(e),c(El.$$.fragment,e),Vv=h(e),yt=a(e,"H3",{class:!0});var D$=i(yt);As=a(D$,"A",{id:!0,class:!0,href:!0});var SI=i(As);Wh=a(SI,"SPAN",{});var LI=i(Wh);c(gl.$$.fragment,LI),LI.forEach(s),SI.forEach(s),Bk=h(D$),Bh=a(D$,"SPAN",{});var UI=i(Bh);Yk=r(UI,"Sending test report to online pastebin service"),UI.forEach(s),D$.forEach(s),Xv=h(e),Mi=a(e,"P",{});var NI=i(Mi);Vk=r(NI,"Creating a URL for each test failure:"),NI.forEach(s),Jv=h(e),c(bl.$$.fragment,e),Zv=h(e),Wi=a(e,"P",{});var HI=i(Wi);Xk=r(HI,`This will submit test run information to a remote Paste service and provide a URL for each failure. You may select
tests as usual or add for example -x if you only want to send one particular failure.`),HI.forEach(s),Kv=h(e),Bi=a(e,"P",{});var zI=i(Bi);Jk=r(zI,"Creating a URL for a whole test session log:"),zI.forEach(s),Qv=h(e),c(kl.$$.fragment,e),e1=h(e),$t=a(e,"H2",{class:!0});var q$=i($t);Ds=a(q$,"A",{id:!0,class:!0,href:!0});var RI=i(Ds);Yh=a(RI,"SPAN",{});var GI=i(Yh);c(Cl.$$.fragment,GI),GI.forEach(s),RI.forEach(s),Zk=h(q$),Vh=a(q$,"SPAN",{});var FI=i(Vh);Kk=r(FI,"Writing tests"),FI.forEach(s),q$.forEach(s),t1=h(e),Te=a(e,"P",{});var Kn=i(Te);Qk=r(Kn,"\u{1F917} transformers tests are based on "),Xh=a(Kn,"CODE",{});var MI=i(Xh);e4=r(MI,"unittest"),MI.forEach(s),t4=r(Kn,", but run by "),Jh=a(Kn,"CODE",{});var WI=i(Jh);s4=r(WI,"pytest"),WI.forEach(s),o4=r(Kn,`, so most of the time features from both systems
can be used.`),Kn.forEach(s),s1=h(e),se=a(e,"P",{});var jo=i(se);r4=r(jo,"You can read "),jl=a(jo,"A",{href:!0,rel:!0});var BI=i(jl);l4=r(BI,"here"),BI.forEach(s),a4=r(jo,` which features are supported, but the important
thing to remember is that most `),Zh=a(jo,"CODE",{});var YI=i(Zh);i4=r(YI,"pytest"),YI.forEach(s),n4=r(jo,` fixtures don\u2019t work. Neither parametrization, but we use the module
`),Kh=a(jo,"CODE",{});var VI=i(Kh);p4=r(VI,"parameterized"),VI.forEach(s),f4=r(jo," that works in a similar way."),jo.forEach(s),o1=h(e),Et=a(e,"H3",{class:!0});var S$=i(Et);qs=a(S$,"A",{id:!0,class:!0,href:!0});var XI=i(qs);Qh=a(XI,"SPAN",{});var JI=i(Qh);c(xl.$$.fragment,JI),JI.forEach(s),XI.forEach(s),h4=h(S$),eu=a(S$,"SPAN",{});var ZI=i(eu);u4=r(ZI,"Parametrization"),ZI.forEach(s),S$.forEach(s),r1=h(e),Yi=a(e,"P",{});var KI=i(Yi);d4=r(KI,`Often, there is a need to run the same test multiple times, but with different arguments. It could be done from within
the test, but then there is no way of running that test for just one set of arguments.`),KI.forEach(s),l1=h(e),c(Pl.$$.fragment,e),a1=h(e),Ss=a(e,"P",{});var L$=i(Ss);c4=r(L$,"Now, by default this test will be run 3 times, each time with the last 3 arguments of "),tu=a(L$,"CODE",{});var QI=i(tu);m4=r(QI,"test_floor"),QI.forEach(s),_4=r(L$,` being assigned the
corresponding arguments in the parameter list.`),L$.forEach(s),i1=h(e),Ae=a(e,"P",{});var Qn=i(Ae);v4=r(Qn,"and you could run just the "),su=a(Qn,"CODE",{});var eT=i(su);w4=r(eT,"negative"),eT.forEach(s),y4=r(Qn," and "),ou=a(Qn,"CODE",{});var tT=i(ou);$4=r(tT,"integer"),tT.forEach(s),E4=r(Qn," sets of params with:"),Qn.forEach(s),n1=h(e),c(Ol.$$.fragment,e),p1=h(e),Ls=a(e,"P",{});var U$=i(Ls);g4=r(U$,"or all but "),ru=a(U$,"CODE",{});var sT=i(ru);b4=r(sT,"negative"),sT.forEach(s),k4=r(U$," sub-tests, with:"),U$.forEach(s),f1=h(e),c(Il.$$.fragment,e),h1=h(e),Us=a(e,"P",{});var N$=i(Us);C4=r(N$,"Besides using the "),lu=a(N$,"CODE",{});var oT=i(lu);j4=r(oT,"-k"),oT.forEach(s),x4=r(N$,` filter that was just mentioned, you can find out the exact name of each sub-test and run any
or all of them using their exact names.`),N$.forEach(s),u1=h(e),c(Tl.$$.fragment,e),d1=h(e),Vi=a(e,"P",{});var rT=i(Vi);P4=r(rT,"and it will list:"),rT.forEach(s),c1=h(e),c(Al.$$.fragment,e),m1=h(e),Xi=a(e,"P",{});var lT=i(Xi);O4=r(lT,"So now you can run just 2 specific sub-tests:"),lT.forEach(s),_1=h(e),c(Dl.$$.fragment,e),v1=h(e),B=a(e,"P",{});var Fe=i(B);I4=r(Fe,"The module "),ql=a(Fe,"A",{href:!0,rel:!0});var aT=i(ql);T4=r(aT,"parameterized"),aT.forEach(s),A4=r(Fe,` which is already in the developer dependencies
of `),au=a(Fe,"CODE",{});var iT=i(au);D4=r(iT,"transformers"),iT.forEach(s),q4=r(Fe," works for both: "),iu=a(Fe,"CODE",{});var nT=i(iu);S4=r(nT,"unittests"),nT.forEach(s),L4=r(Fe," and "),nu=a(Fe,"CODE",{});var pT=i(nu);U4=r(pT,"pytest"),pT.forEach(s),N4=r(Fe," tests."),Fe.forEach(s),w1=h(e),oe=a(e,"P",{});var xo=i(oe);H4=r(xo,"If, however, the test is not a "),pu=a(xo,"CODE",{});var fT=i(pu);z4=r(fT,"unittest"),fT.forEach(s),R4=r(xo,", you may use "),fu=a(xo,"CODE",{});var hT=i(fu);G4=r(hT,"pytest.mark.parametrize"),hT.forEach(s),F4=r(xo,` (or you may see it being used in
some existing tests, mostly under `),hu=a(xo,"CODE",{});var uT=i(hu);M4=r(uT,"examples"),uT.forEach(s),W4=r(xo,")."),xo.forEach(s),y1=h(e),De=a(e,"P",{});var ep=i(De);B4=r(ep,"Here is the same example, this time using "),uu=a(ep,"CODE",{});var dT=i(uu);Y4=r(dT,"pytest"),dT.forEach(s),V4=r(ep,"\u2019s "),du=a(ep,"CODE",{});var cT=i(du);X4=r(cT,"parametrize"),cT.forEach(s),J4=r(ep," marker:"),ep.forEach(s),$1=h(e),c(Sl.$$.fragment,e),E1=h(e),re=a(e,"P",{});var Po=i(re);Z4=r(Po,"Same as with "),cu=a(Po,"CODE",{});var mT=i(cu);K4=r(mT,"parameterized"),mT.forEach(s),Q4=r(Po,", with "),mu=a(Po,"CODE",{});var _T=i(mu);e0=r(_T,"pytest.mark.parametrize"),_T.forEach(s),t0=r(Po,` you can have a fine control over which sub-tests are
run, if the `),_u=a(Po,"CODE",{});var vT=i(_u);s0=r(vT,"-k"),vT.forEach(s),o0=r(Po,` filter doesn\u2019t do the job. Except, this parametrization function creates a slightly different set of
names for the sub-tests. Here is what they look like:`),Po.forEach(s),g1=h(e),c(Ll.$$.fragment,e),b1=h(e),Ji=a(e,"P",{});var wT=i(Ji);r0=r(wT,"and it will list:"),wT.forEach(s),k1=h(e),c(Ul.$$.fragment,e),C1=h(e),Zi=a(e,"P",{});var yT=i(Zi);l0=r(yT,"So now you can run just the specific test:"),yT.forEach(s),j1=h(e),c(Nl.$$.fragment,e),x1=h(e),Ki=a(e,"P",{});var $T=i(Ki);a0=r($T,"as in the previous example."),$T.forEach(s),P1=h(e),gt=a(e,"H3",{class:!0});var H$=i(gt);Ns=a(H$,"A",{id:!0,class:!0,href:!0});var ET=i(Ns);vu=a(ET,"SPAN",{});var gT=i(vu);c(Hl.$$.fragment,gT),gT.forEach(s),ET.forEach(s),i0=h(H$),wu=a(H$,"SPAN",{});var bT=i(wu);n0=r(bT,"Files and directories"),bT.forEach(s),H$.forEach(s),O1=h(e),Hs=a(e,"P",{});var z$=i(Hs);p0=r(z$,`In tests often we need to know where things are relative to the current test file, and it\u2019s not trivial since the test
could be invoked from more than one directory or could reside in sub-directories with different depths. A helper class
`),yu=a(z$,"CODE",{});var kT=i(yu);f0=r(kT,"transformers.test_utils.TestCasePlus"),kT.forEach(s),h0=r(z$,` solves this problem by sorting out all the basic paths and provides easy
accessors to them:`),z$.forEach(s),I1=h(e),zs=a(e,"UL",{});var R$=i(zs);zl=a(R$,"LI",{});var G$=i(zl);Qi=a(G$,"P",{});var Ej=i(Qi);$u=a(Ej,"CODE",{});var CT=i($u);u0=r(CT,"pathlib"),CT.forEach(s),d0=r(Ej," objects (all fully resolved):"),Ej.forEach(s),c0=h(G$),G=a(G$,"UL",{});var ue=i(G);Rl=a(ue,"LI",{});var F$=i(Rl);Eu=a(F$,"CODE",{});var jT=i(Eu);m0=r(jT,"test_file_path"),jT.forEach(s),_0=r(F$," - the current test file path, i.e. "),gu=a(F$,"CODE",{});var xT=i(gu);v0=r(xT,"__file__"),xT.forEach(s),F$.forEach(s),w0=h(ue),en=a(ue,"LI",{});var gj=i(en);bu=a(gj,"CODE",{});var PT=i(bu);y0=r(PT,"test_file_dir"),PT.forEach(s),$0=r(gj," - the directory containing the current test file"),gj.forEach(s),E0=h(ue),Rs=a(ue,"LI",{});var nm=i(Rs);ku=a(nm,"CODE",{});var OT=i(ku);g0=r(OT,"tests_dir"),OT.forEach(s),b0=r(nm," - the directory of the "),Cu=a(nm,"CODE",{});var IT=i(Cu);k0=r(IT,"tests"),IT.forEach(s),C0=r(nm," test suite"),nm.forEach(s),j0=h(ue),Gs=a(ue,"LI",{});var pm=i(Gs);ju=a(pm,"CODE",{});var TT=i(ju);x0=r(TT,"examples_dir"),TT.forEach(s),P0=r(pm," - the directory of the "),xu=a(pm,"CODE",{});var AT=i(xu);O0=r(AT,"examples"),AT.forEach(s),I0=r(pm," test suite"),pm.forEach(s),T0=h(ue),tn=a(ue,"LI",{});var bj=i(tn);Pu=a(bj,"CODE",{});var DT=i(Pu);A0=r(DT,"repo_root_dir"),DT.forEach(s),D0=r(bj," - the directory of the repository"),bj.forEach(s),q0=h(ue),qe=a(ue,"LI",{});var ei=i(qe);Ou=a(ei,"CODE",{});var qT=i(Ou);S0=r(qT,"src_dir"),qT.forEach(s),L0=r(ei," - the directory of "),Iu=a(ei,"CODE",{});var ST=i(Iu);U0=r(ST,"src"),ST.forEach(s),N0=r(ei," (i.e. where the "),Tu=a(ei,"CODE",{});var LT=i(Tu);H0=r(LT,"transformers"),LT.forEach(s),z0=r(ei," sub-dir resides)"),ei.forEach(s),ue.forEach(s),G$.forEach(s),R0=h(R$),Gl=a(R$,"LI",{});var M$=i(Gl);Fl=a(M$,"P",{});var W$=i(Fl);G0=r(W$,"stringified paths---same as above but these return paths as strings, rather than "),Au=a(W$,"CODE",{});var UT=i(Au);F0=r(UT,"pathlib"),UT.forEach(s),M0=r(W$," objects:"),W$.forEach(s),W0=h(M$),F=a(M$,"UL",{});var de=i(F);Du=a(de,"LI",{});var NT=i(Du);qu=a(NT,"CODE",{});var HT=i(qu);B0=r(HT,"test_file_path_str"),HT.forEach(s),NT.forEach(s),Y0=h(de),Su=a(de,"LI",{});var zT=i(Su);Lu=a(zT,"CODE",{});var RT=i(Lu);V0=r(RT,"test_file_dir_str"),RT.forEach(s),zT.forEach(s),X0=h(de),Uu=a(de,"LI",{});var GT=i(Uu);Nu=a(GT,"CODE",{});var FT=i(Nu);J0=r(FT,"tests_dir_str"),FT.forEach(s),GT.forEach(s),Z0=h(de),Hu=a(de,"LI",{});var MT=i(Hu);zu=a(MT,"CODE",{});var WT=i(zu);K0=r(WT,"examples_dir_str"),WT.forEach(s),MT.forEach(s),Q0=h(de),Ru=a(de,"LI",{});var BT=i(Ru);Gu=a(BT,"CODE",{});var YT=i(Gu);e6=r(YT,"repo_root_dir_str"),YT.forEach(s),BT.forEach(s),t6=h(de),Fu=a(de,"LI",{});var VT=i(Fu);Mu=a(VT,"CODE",{});var XT=i(Mu);s6=r(XT,"src_dir_str"),XT.forEach(s),VT.forEach(s),de.forEach(s),M$.forEach(s),R$.forEach(s),T1=h(e),Fs=a(e,"P",{});var B$=i(Fs);o6=r(B$,`To start using those all you need is to make sure that the test resides in a subclass of
`),Wu=a(B$,"CODE",{});var JT=i(Wu);r6=r(JT,"transformers.test_utils.TestCasePlus"),JT.forEach(s),l6=r(B$,". For example:"),B$.forEach(s),A1=h(e),c(Ml.$$.fragment,e),D1=h(e),Y=a(e,"P",{});var Me=i(Y);a6=r(Me,"If you don\u2019t need to manipulate paths via "),Bu=a(Me,"CODE",{});var ZT=i(Bu);i6=r(ZT,"pathlib"),ZT.forEach(s),n6=r(Me,` or you just need a path as a string, you can always invoked
`),Yu=a(Me,"CODE",{});var KT=i(Yu);p6=r(KT,"str()"),KT.forEach(s),f6=r(Me," on the "),Vu=a(Me,"CODE",{});var QT=i(Vu);h6=r(QT,"pathlib"),QT.forEach(s),u6=r(Me," object or use the accessors ending with "),Xu=a(Me,"CODE",{});var eA=i(Xu);d6=r(eA,"_str"),eA.forEach(s),c6=r(Me,". For example:"),Me.forEach(s),q1=h(e),c(Wl.$$.fragment,e),S1=h(e),bt=a(e,"H3",{class:!0});var Y$=i(bt);Ms=a(Y$,"A",{id:!0,class:!0,href:!0});var tA=i(Ms);Ju=a(tA,"SPAN",{});var sA=i(Ju);c(Bl.$$.fragment,sA),sA.forEach(s),tA.forEach(s),m6=h(Y$),Zu=a(Y$,"SPAN",{});var oA=i(Zu);_6=r(oA,"Temporary files and directories"),oA.forEach(s),Y$.forEach(s),L1=h(e),Ws=a(e,"P",{});var V$=i(Ws);v6=r(V$,`Using unique temporary files and directories are essential for parallel test running, so that the tests won\u2019t overwrite
each other\u2019s data. Also we want to get the temporary files and directories removed at the end of each test that created
them. Therefore, using packages like `),Ku=a(V$,"CODE",{});var rA=i(Ku);w6=r(rA,"tempfile"),rA.forEach(s),y6=r(V$,", which address these needs is essential."),V$.forEach(s),U1=h(e),sn=a(e,"P",{});var lA=i(sn);$6=r(lA,`However, when debugging tests, you need to be able to see what goes into the temporary file or directory and you want
to know it\u2019s exact path and not having it randomized on every test re-run.`),lA.forEach(s),N1=h(e),Se=a(e,"P",{});var tp=i(Se);E6=r(tp,"A helper class "),Qu=a(tp,"CODE",{});var aA=i(Qu);g6=r(aA,"transformers.test_utils.TestCasePlus"),aA.forEach(s),b6=r(tp,` is best used for such purposes. It\u2019s a sub-class of
`),ed=a(tp,"CODE",{});var iA=i(ed);k6=r(iA,"unittest.TestCase"),iA.forEach(s),C6=r(tp,", so we can easily inherit from it in the test modules."),tp.forEach(s),H1=h(e),on=a(e,"P",{});var nA=i(on);j6=r(nA,"Here is an example of its usage:"),nA.forEach(s),z1=h(e),c(Yl.$$.fragment,e),R1=h(e),Bs=a(e,"P",{});var X$=i(Bs);x6=r(X$,"This code creates a unique temporary directory, and sets "),td=a(X$,"CODE",{});var pA=i(td);P6=r(pA,"tmp_dir"),pA.forEach(s),O6=r(X$," to its location."),X$.forEach(s),G1=h(e),rn=a(e,"UL",{});var fA=i(rn);sd=a(fA,"LI",{});var hA=i(sd);I6=r(hA,"Create a unique temporary dir:"),hA.forEach(s),fA.forEach(s),F1=h(e),c(Vl.$$.fragment,e),M1=h(e),Xl=a(e,"P",{});var kj=i(Xl);od=a(kj,"CODE",{});var uA=i(od);T6=r(uA,"tmp_dir"),uA.forEach(s),A6=r(kj,` will contain the path to the created temporary dir. It will be automatically removed at the end of the
test.`),kj.forEach(s),W1=h(e),ln=a(e,"UL",{});var dA=i(ln);rd=a(dA,"LI",{});var cA=i(rd);D6=r(cA,"Create a temporary dir of my choice, ensure it\u2019s empty before the test starts and don\u2019t empty it after the test."),cA.forEach(s),dA.forEach(s),B1=h(e),c(Jl.$$.fragment,e),Y1=h(e),an=a(e,"P",{});var mA=i(an);q6=r(mA,`This is useful for debug when you want to monitor a specific directory and want to make sure the previous tests didn\u2019t
leave any data in there.`),mA.forEach(s),V1=h(e),nn=a(e,"UL",{});var _A=i(nn);Zl=a(_A,"LI",{});var J$=i(Zl);kt=a(J$,"P",{});var sp=i(kt);S6=r(sp,"You can override the default behavior by directly overriding the "),ld=a(sp,"CODE",{});var vA=i(ld);L6=r(vA,"before"),vA.forEach(s),U6=r(sp," and "),ad=a(sp,"CODE",{});var wA=i(ad);N6=r(wA,"after"),wA.forEach(s),H6=r(sp,` args, leading to one of the
following behaviors:`),sp.forEach(s),z6=h(J$),ve=a(J$,"UL",{});var Oo=i(ve);pn=a(Oo,"LI",{});var Cj=i(pn);id=a(Cj,"CODE",{});var yA=i(id);R6=r(yA,"before=True"),yA.forEach(s),G6=r(Cj,": the temporary dir will always be cleared at the beginning of the test."),Cj.forEach(s),F6=h(Oo),fn=a(Oo,"LI",{});var jj=i(fn);nd=a(jj,"CODE",{});var $A=i(nd);M6=r($A,"before=False"),$A.forEach(s),W6=r(jj,": if the temporary dir already existed, any existing files will remain there."),jj.forEach(s),B6=h(Oo),hn=a(Oo,"LI",{});var xj=i(hn);pd=a(xj,"CODE",{});var EA=i(pd);Y6=r(EA,"after=True"),EA.forEach(s),V6=r(xj,": the temporary dir will always be deleted at the end of the test."),xj.forEach(s),X6=h(Oo),un=a(Oo,"LI",{});var Pj=i(un);fd=a(Pj,"CODE",{});var gA=i(fd);J6=r(gA,"after=False"),gA.forEach(s),Z6=r(Pj,": the temporary dir will always be left intact at the end of the test."),Pj.forEach(s),Oo.forEach(s),J$.forEach(s),_A.forEach(s),X1=h(e),c(Ys.$$.fragment,e),J1=h(e),c(Vs.$$.fragment,e),Z1=h(e),Ct=a(e,"H3",{class:!0});var Z$=i(Ct);Xs=a(Z$,"A",{id:!0,class:!0,href:!0});var bA=i(Xs);hd=a(bA,"SPAN",{});var kA=i(hd);c(Kl.$$.fragment,kA),kA.forEach(s),bA.forEach(s),K6=h(Z$),ud=a(Z$,"SPAN",{});var CA=i(ud);Q6=r(CA,"Temporary sys.path override"),CA.forEach(s),Z$.forEach(s),K1=h(e),Le=a(e,"P",{});var op=i(Le);e7=r(op,"If you need to temporary override "),dd=a(op,"CODE",{});var jA=i(dd);t7=r(jA,"sys.path"),jA.forEach(s),s7=r(op,` to import from another test for example, you can use the
`),cd=a(op,"CODE",{});var xA=i(cd);o7=r(xA,"ExtendSysPath"),xA.forEach(s),r7=r(op," context manager. Example:"),op.forEach(s),Q1=h(e),c(Ql.$$.fragment,e),ew=h(e),jt=a(e,"H3",{class:!0});var K$=i(jt);Js=a(K$,"A",{id:!0,class:!0,href:!0});var PA=i(Js);md=a(PA,"SPAN",{});var OA=i(md);c(ea.$$.fragment,OA),OA.forEach(s),PA.forEach(s),l7=h(K$),_d=a(K$,"SPAN",{});var IA=i(_d);a7=r(IA,"Skipping tests"),IA.forEach(s),K$.forEach(s),tw=h(e),Zs=a(e,"P",{});var Q$=i(Zs);i7=r(Q$,`This is useful when a bug is found and a new test is written, yet the bug is not fixed yet. In order to be able to
commit it to the main repository we need make sure it\u2019s skipped during `),vd=a(Q$,"CODE",{});var TA=i(vd);n7=r(TA,"make test"),TA.forEach(s),p7=r(Q$,"."),Q$.forEach(s),sw=h(e),dn=a(e,"P",{});var AA=i(dn);f7=r(AA,"Methods:"),AA.forEach(s),ow=h(e),Ks=a(e,"UL",{});var eE=i(Ks);wd=a(eE,"LI",{});var DA=i(wd);ta=a(DA,"P",{});var tE=i(ta);h7=r(tE,"A "),yd=a(tE,"STRONG",{});var qA=i(yd);u7=r(qA,"skip"),qA.forEach(s),d7=r(tE,` means that you expect your test to pass only if some conditions are met, otherwise pytest should skip
running the test altogether. Common examples are skipping windows-only tests on non-windows platforms, or skipping
tests that depend on an external resource which is not available at the moment (for example a database).`),tE.forEach(s),DA.forEach(s),c7=h(eE),$d=a(eE,"LI",{});var SA=i($d);sa=a(SA,"P",{});var sE=i(sa);m7=r(sE,"A "),Ed=a(sE,"STRONG",{});var LA=i(Ed);_7=r(LA,"xfail"),LA.forEach(s),v7=r(sE,` means that you expect a test to fail for some reason. A common example is a test for a feature not yet
implemented, or a bug not yet fixed. When a test passes despite being expected to fail (marked with
pytest.mark.xfail), it\u2019s an xpass and will be reported in the test summary.`),sE.forEach(s),SA.forEach(s),eE.forEach(s),rw=h(e),le=a(e,"P",{});var Io=i(le);w7=r(Io,"One of the important differences between the two is that "),gd=a(Io,"CODE",{});var UA=i(gd);y7=r(UA,"skip"),UA.forEach(s),$7=r(Io," doesn\u2019t run the test, and "),bd=a(Io,"CODE",{});var NA=i(bd);E7=r(NA,"xfail"),NA.forEach(s),g7=r(Io,` does. So if the
code that\u2019s buggy causes some bad state that will affect other tests, do not use `),kd=a(Io,"CODE",{});var HA=i(kd);b7=r(HA,"xfail"),HA.forEach(s),k7=r(Io,"."),Io.forEach(s),lw=h(e),xt=a(e,"H4",{class:!0});var oE=i(xt);Qs=a(oE,"A",{id:!0,class:!0,href:!0});var zA=i(Qs);Cd=a(zA,"SPAN",{});var RA=i(Cd);c(oa.$$.fragment,RA),RA.forEach(s),zA.forEach(s),C7=h(oE),jd=a(oE,"SPAN",{});var GA=i(jd);j7=r(GA,"Implementation"),GA.forEach(s),oE.forEach(s),aw=h(e),cn=a(e,"UL",{});var FA=i(cn);xd=a(FA,"LI",{});var MA=i(xd);x7=r(MA,"Here is how to skip whole test unconditionally:"),MA.forEach(s),FA.forEach(s),iw=h(e),c(ra.$$.fragment,e),nw=h(e),mn=a(e,"P",{});var WA=i(mn);P7=r(WA,"or via pytest:"),WA.forEach(s),pw=h(e),c(la.$$.fragment,e),fw=h(e),eo=a(e,"P",{});var rE=i(eo);O7=r(rE,"or the "),Pd=a(rE,"CODE",{});var BA=i(Pd);I7=r(BA,"xfail"),BA.forEach(s),T7=r(rE," way:"),rE.forEach(s),hw=h(e),c(aa.$$.fragment,e),uw=h(e),_n=a(e,"UL",{});var YA=i(_n);Od=a(YA,"LI",{});var VA=i(Od);A7=r(VA,"Here is how to skip a test based on some internal check inside the test:"),VA.forEach(s),YA.forEach(s),dw=h(e),c(ia.$$.fragment,e),cw=h(e),vn=a(e,"P",{});var XA=i(vn);D7=r(XA,"or the whole module:"),XA.forEach(s),mw=h(e),c(na.$$.fragment,e),_w=h(e),to=a(e,"P",{});var lE=i(to);q7=r(lE,"or the "),Id=a(lE,"CODE",{});var JA=i(Id);S7=r(JA,"xfail"),JA.forEach(s),L7=r(lE," way:"),lE.forEach(s),vw=h(e),c(pa.$$.fragment,e),ww=h(e),wn=a(e,"UL",{});var ZA=i(wn);Td=a(ZA,"LI",{});var KA=i(Td);U7=r(KA,"Here is how to skip all tests in a module if some import is missing:"),KA.forEach(s),ZA.forEach(s),yw=h(e),c(fa.$$.fragment,e),$w=h(e),yn=a(e,"UL",{});var QA=i(yn);Ad=a(QA,"LI",{});var eD=i(Ad);N7=r(eD,"Skip a test based on a condition:"),eD.forEach(s),QA.forEach(s),Ew=h(e),c(ha.$$.fragment,e),gw=h(e),$n=a(e,"P",{});var tD=i($n);H7=r(tD,"or:"),tD.forEach(s),bw=h(e),c(ua.$$.fragment,e),kw=h(e),En=a(e,"P",{});var sD=i(En);z7=r(sD,"or skip the whole module:"),sD.forEach(s),Cw=h(e),c(da.$$.fragment,e),jw=h(e),so=a(e,"P",{});var aE=i(so);R7=r(aE,"More details, example and ways are "),ca=a(aE,"A",{href:!0,rel:!0});var oD=i(ca);G7=r(oD,"here"),oD.forEach(s),F7=r(aE,"."),aE.forEach(s),xw=h(e),Pt=a(e,"H3",{class:!0});var iE=i(Pt);oo=a(iE,"A",{id:!0,class:!0,href:!0});var rD=i(oo);Dd=a(rD,"SPAN",{});var lD=i(Dd);c(ma.$$.fragment,lD),lD.forEach(s),rD.forEach(s),M7=h(iE),qd=a(iE,"SPAN",{});var aD=i(qd);W7=r(aD,"Slow tests"),aD.forEach(s),iE.forEach(s),Pw=h(e),gn=a(e,"P",{});var iD=i(gn);B7=r(iD,`The library of tests is ever-growing, and some of the tests take minutes to run, therefore we can\u2019t afford waiting for
an hour for the test suite to complete on CI. Therefore, with some exceptions for essential tests, slow tests should be
marked as in the example below:`),iD.forEach(s),Ow=h(e),c(_a.$$.fragment,e),Iw=h(e),Ue=a(e,"P",{});var rp=i(Ue);Y7=r(rp,"Once a test is marked as "),Sd=a(rp,"CODE",{});var nD=i(Sd);V7=r(nD,"@slow"),nD.forEach(s),X7=r(rp,", to run such tests set "),Ld=a(rp,"CODE",{});var pD=i(Ld);J7=r(pD,"RUN_SLOW=1"),pD.forEach(s),Z7=r(rp," env var, e.g.:"),rp.forEach(s),Tw=h(e),c(va.$$.fragment,e),Aw=h(e),ae=a(e,"P",{});var To=i(ae);K7=r(To,"Some decorators like "),Ud=a(To,"CODE",{});var fD=i(Ud);Q7=r(fD,"@parameterized"),fD.forEach(s),e8=r(To," rewrite test names, therefore "),Nd=a(To,"CODE",{});var hD=i(Nd);t8=r(hD,"@slow"),hD.forEach(s),s8=r(To,` and the rest of the skip decorators
`),Hd=a(To,"CODE",{});var uD=i(Hd);o8=r(uD,"@require_*"),uD.forEach(s),r8=r(To," have to be listed last for them to work correctly. Here is an example of the correct usage:"),To.forEach(s),Dw=h(e),c(wa.$$.fragment,e),qw=h(e),bn=a(e,"P",{});var dD=i(bn);l8=r(dD,`As explained at the beginning of this document, slow tests get to run on a scheduled basis, rather than in PRs CI
checks. So it\u2019s possible that some problems will be missed during a PR submission and get merged. Such problems will
get caught during the next scheduled CI job. But it also means that it\u2019s important to run the slow tests on your
machine before submitting the PR.`),dD.forEach(s),Sw=h(e),kn=a(e,"P",{});var cD=i(kn);a8=r(cD,"Here is a rough decision making mechanism for choosing which tests should be marked as slow:"),cD.forEach(s),Lw=h(e),Cn=a(e,"P",{});var mD=i(Cn);i8=r(mD,`If the test is focused on one of the library\u2019s internal components (e.g., modeling files, tokenization files,
pipelines), then we should run that test in the non-slow test suite. If it\u2019s focused on an other aspect of the library,
such as the documentation or the examples, then we should run these tests in the slow test suite. And then, to refine
this approach we should have exceptions:`),mD.forEach(s),Uw=h(e),ie=a(e,"UL",{});var Ao=i(ie);zd=a(Ao,"LI",{});var _D=i(zd);n8=r(_D,`All tests that need to download a heavy set of weights or a dataset that is larger than ~50MB (e.g., model or
tokenizer integration tests, pipeline integration tests) should be set to slow. If you\u2019re adding a new model, you
should create and upload to the hub a tiny version of it (with random weights) for integration tests. This is
discussed in the following paragraphs.`),_D.forEach(s),p8=h(Ao),Rd=a(Ao,"LI",{});var vD=i(Rd);f8=r(vD,"All tests that need to do a training not specifically optimized to be fast should be set to slow."),vD.forEach(s),h8=h(Ao),Ot=a(Ao,"LI",{});var lp=i(Ot);u8=r(lp,`We can introduce exceptions if some of these should-be-non-slow tests are excruciatingly slow, and set them to
`),Gd=a(lp,"CODE",{});var wD=i(Gd);d8=r(wD,"@slow"),wD.forEach(s),c8=r(lp,`. Auto-modeling tests, which save and load large files to disk, are a good example of tests that are marked
as `),Fd=a(lp,"CODE",{});var yD=i(Fd);m8=r(yD,"@slow"),yD.forEach(s),_8=r(lp,"."),lp.forEach(s),v8=h(Ao),Md=a(Ao,"LI",{});var $D=i(Md);w8=r($D,"If a test completes under 1 second on CI (including downloads if any) then it should be a normal test regardless."),$D.forEach(s),Ao.forEach(s),Nw=h(e),Ne=a(e,"P",{});var ap=i(Ne);y8=r(ap,`Collectively, all the non-slow tests need to cover entirely the different internals, while remaining fast. For example,
a significant coverage can be achieved by testing with specially created tiny models with random weights. Such models
have the very minimal number of layers (e.g., 2), vocab size (e.g., 1000), etc. Then the `),Wd=a(ap,"CODE",{});var ED=i(Wd);$8=r(ED,"@slow"),ED.forEach(s),E8=r(ap,` tests can use large
slow models to do qualitative testing. To see the use of these simply look for `),Bd=a(ap,"EM",{});var gD=i(Bd);g8=r(gD,"tiny"),gD.forEach(s),b8=r(ap," models with:"),ap.forEach(s),Hw=h(e),c(ya.$$.fragment,e),zw=h(e),He=a(e,"P",{});var ip=i(He);k8=r(ip,"Here is a an example of a "),$a=a(ip,"A",{href:!0,rel:!0});var bD=i($a);C8=r(bD,"script"),bD.forEach(s),j8=r(ip,` that created the tiny model
`),Ea=a(ip,"A",{href:!0,rel:!0});var kD=i(Ea);x8=r(kD,"stas/tiny-wmt19-en-de"),kD.forEach(s),P8=r(ip,`. You can easily adjust it to your specific
model\u2019s architecture.`),ip.forEach(s),Rw=h(e),ro=a(e,"P",{});var nE=i(ro);O8=r(nE,`It\u2019s easy to measure the run-time incorrectly if for example there is an overheard of downloading a huge model, but if
you test it locally the downloaded files would be cached and thus the download time not measured. Hence check the
execution speed report in CI logs instead (the output of `),Yd=a(nE,"CODE",{});var CD=i(Yd);I8=r(CD,"pytest --durations=0 tests"),CD.forEach(s),T8=r(nE,")."),nE.forEach(s),Gw=h(e),jn=a(e,"P",{});var jD=i(jn);A8=r(jD,`That report is also useful to find slow outliers that aren\u2019t marked as such, or which need to be re-written to be fast.
If you notice that the test suite starts getting slow on CI, the top listing of this report will show the slowest
tests.`),jD.forEach(s),Fw=h(e),It=a(e,"H3",{class:!0});var pE=i(It);lo=a(pE,"A",{id:!0,class:!0,href:!0});var xD=i(lo);Vd=a(xD,"SPAN",{});var PD=i(Vd);c(ga.$$.fragment,PD),PD.forEach(s),xD.forEach(s),D8=h(pE),Xd=a(pE,"SPAN",{});var OD=i(Xd);q8=r(OD,"Testing the stdout/stderr output"),OD.forEach(s),pE.forEach(s),Mw=h(e),V=a(e,"P",{});var We=i(V);S8=r(We,"In order to test functions that write to "),Jd=a(We,"CODE",{});var ID=i(Jd);L8=r(ID,"stdout"),ID.forEach(s),U8=r(We," and/or "),Zd=a(We,"CODE",{});var TD=i(Zd);N8=r(TD,"stderr"),TD.forEach(s),H8=r(We,`, the test can access those streams using the
`),Kd=a(We,"CODE",{});var AD=i(Kd);z8=r(AD,"pytest"),AD.forEach(s),R8=r(We,"\u2019s "),ba=a(We,"A",{href:!0,rel:!0});var DD=i(ba);G8=r(DD,"capsys system"),DD.forEach(s),F8=r(We,". Here is how this is accomplished:"),We.forEach(s),Ww=h(e),c(ka.$$.fragment,e),Bw=h(e),ao=a(e,"P",{});var fE=i(ao);M8=r(fE,"And, of course, most of the time, "),Qd=a(fE,"CODE",{});var qD=i(Qd);W8=r(qD,"stderr"),qD.forEach(s),B8=r(fE,` will come as a part of an exception, so try/except has to be used in such
a case:`),fE.forEach(s),Yw=h(e),c(Ca.$$.fragment,e),Vw=h(e),io=a(e,"P",{});var hE=i(io);Y8=r(hE,"Another approach to capturing stdout is via "),ec=a(hE,"CODE",{});var SD=i(ec);V8=r(SD,"contextlib.redirect_stdout"),SD.forEach(s),X8=r(hE,":"),hE.forEach(s),Xw=h(e),c(ja.$$.fragment,e),Jw=h(e),T=a(e,"P",{});var J=i(T);J8=r(J,"An important potential issue with capturing stdout is that it may contain "),tc=a(J,"CODE",{});var LD=i(tc);Z8=r(LD,"\\r"),LD.forEach(s),K8=r(J," characters that in normal "),sc=a(J,"CODE",{});var UD=i(sc);Q8=r(UD,"print"),UD.forEach(s),e9=r(J,`
reset everything that has been printed so far. There is no problem with `),oc=a(J,"CODE",{});var ND=i(oc);t9=r(ND,"pytest"),ND.forEach(s),s9=r(J,", but with "),rc=a(J,"CODE",{});var HD=i(rc);o9=r(HD,"pytest -s"),HD.forEach(s),r9=r(J,` these
characters get included in the buffer, so to be able to have the test run with and without `),lc=a(J,"CODE",{});var zD=i(lc);l9=r(zD,"-s"),zD.forEach(s),a9=r(J,`, you have to make an
extra cleanup to the captured output, using `),ac=a(J,"CODE",{});var RD=i(ac);i9=r(RD,"re.sub(r'~.*\\r', '', buf, 0, re.M)"),RD.forEach(s),n9=r(J,"."),J.forEach(s),Zw=h(e),no=a(e,"P",{});var uE=i(no);p9=r(uE,`But, then we have a helper context manager wrapper to automatically take care of it all, regardless of whether it has
some `),ic=a(uE,"CODE",{});var GD=i(ic);f9=r(GD,"\\r"),GD.forEach(s),h9=r(uE,"\u2019s in it or not, so it\u2019s a simple:"),uE.forEach(s),Kw=h(e),c(xa.$$.fragment,e),Qw=h(e),xn=a(e,"P",{});var FD=i(xn);u9=r(FD,"Here is a full test example:"),FD.forEach(s),ey=h(e),c(Pa.$$.fragment,e),ty=h(e),ze=a(e,"P",{});var np=i(ze);d9=r(np,"If you\u2019d like to capture "),nc=a(np,"CODE",{});var MD=i(nc);c9=r(MD,"stderr"),MD.forEach(s),m9=r(np," use the "),pc=a(np,"CODE",{});var WD=i(pc);_9=r(WD,"CaptureStderr"),WD.forEach(s),v9=r(np," class instead:"),np.forEach(s),sy=h(e),c(Oa.$$.fragment,e),oy=h(e),po=a(e,"P",{});var dE=i(po);w9=r(dE,"If you need to capture both streams at once, use the parent "),fc=a(dE,"CODE",{});var BD=i(fc);y9=r(BD,"CaptureStd"),BD.forEach(s),$9=r(dE," class:"),dE.forEach(s),ry=h(e),c(Ia.$$.fragment,e),ly=h(e),Pn=a(e,"P",{});var YD=i(Pn);E9=r(YD,`Also, to aid debugging test issues, by default these context managers automatically replay the captured streams on exit
from the context.`),YD.forEach(s),ay=h(e),Tt=a(e,"H3",{class:!0});var cE=i(Tt);fo=a(cE,"A",{id:!0,class:!0,href:!0});var VD=i(fo);hc=a(VD,"SPAN",{});var XD=i(hc);c(Ta.$$.fragment,XD),XD.forEach(s),VD.forEach(s),g9=h(cE),uc=a(cE,"SPAN",{});var JD=i(uc);b9=r(JD,"Capturing logger stream"),JD.forEach(s),cE.forEach(s),iy=h(e),ho=a(e,"P",{});var mE=i(ho);k9=r(mE,"If you need to validate the output of a logger, you can use "),dc=a(mE,"CODE",{});var ZD=i(dc);C9=r(ZD,"CaptureLogger"),ZD.forEach(s),j9=r(mE,":"),mE.forEach(s),ny=h(e),c(Aa.$$.fragment,e),py=h(e),At=a(e,"H3",{class:!0});var _E=i(At);uo=a(_E,"A",{id:!0,class:!0,href:!0});var KD=i(uo);cc=a(KD,"SPAN",{});var QD=i(cc);c(Da.$$.fragment,QD),QD.forEach(s),KD.forEach(s),x9=h(_E),mc=a(_E,"SPAN",{});var eq=i(mc);P9=r(eq,"Testing with environment variables"),eq.forEach(s),_E.forEach(s),fy=h(e),qa=a(e,"P",{});var Oj=i(qa);O9=r(Oj,`If you want to test the impact of environment variables for a specific test you can use a helper decorator
`),_c=a(Oj,"CODE",{});var tq=i(_c);I9=r(tq,"transformers.testing_utils.mockenv"),tq.forEach(s),Oj.forEach(s),hy=h(e),c(Sa.$$.fragment,e),uy=h(e),ne=a(e,"P",{});var Do=i(ne);T9=r(Do,"At times an external program needs to be called, which requires setting "),vc=a(Do,"CODE",{});var sq=i(vc);A9=r(sq,"PYTHONPATH"),sq.forEach(s),D9=r(Do," in "),wc=a(Do,"CODE",{});var oq=i(wc);q9=r(oq,"os.environ"),oq.forEach(s),S9=r(Do,` to include
multiple local paths. A helper class `),yc=a(Do,"CODE",{});var rq=i(yc);L9=r(rq,"transformers.test_utils.TestCasePlus"),rq.forEach(s),U9=r(Do," comes to help:"),Do.forEach(s),dy=h(e),c(La.$$.fragment,e),cy=h(e),N=a(e,"P",{});var ce=i(N);N9=r(ce,"Depending on whether the test file was under the "),$c=a(ce,"CODE",{});var lq=i($c);H9=r(lq,"tests"),lq.forEach(s),z9=r(ce," test suite or "),Ec=a(ce,"CODE",{});var aq=i(Ec);R9=r(aq,"examples"),aq.forEach(s),G9=r(ce,` it\u2019ll correctly set up
`),gc=a(ce,"CODE",{});var iq=i(gc);F9=r(iq,"env[PYTHONPATH]"),iq.forEach(s),M9=r(ce," to include one of these two directories, and also the "),bc=a(ce,"CODE",{});var nq=i(bc);W9=r(nq,"src"),nq.forEach(s),B9=r(ce,` directory to ensure the testing is
done against the current repo, and finally with whatever `),kc=a(ce,"CODE",{});var pq=i(kc);Y9=r(pq,"env[PYTHONPATH]"),pq.forEach(s),V9=r(ce,` was already set to before the test was
called if anything.`),ce.forEach(s),my=h(e),co=a(e,"P",{});var vE=i(co);X9=r(vE,"This helper method creates a copy of the "),Cc=a(vE,"CODE",{});var fq=i(Cc);J9=r(fq,"os.environ"),fq.forEach(s),Z9=r(vE," object, so the original remains intact."),vE.forEach(s),_y=h(e),Dt=a(e,"H3",{class:!0});var wE=i(Dt);mo=a(wE,"A",{id:!0,class:!0,href:!0});var hq=i(mo);jc=a(hq,"SPAN",{});var uq=i(jc);c(Ua.$$.fragment,uq),uq.forEach(s),hq.forEach(s),K9=h(wE),xc=a(wE,"SPAN",{});var dq=i(xc);Q9=r(dq,"Getting reproducible results"),dq.forEach(s),wE.forEach(s),vy=h(e),On=a(e,"P",{});var cq=i(On);eC=r(cq,`In some situations you may want to remove randomness for your tests. To get identical reproducable results set, you
will need to fix the seed:`),cq.forEach(s),wy=h(e),c(Na.$$.fragment,e),yy=h(e),qt=a(e,"H3",{class:!0});var yE=i(qt);_o=a(yE,"A",{id:!0,class:!0,href:!0});var mq=i(_o);Pc=a(mq,"SPAN",{});var _q=i(Pc);c(Ha.$$.fragment,_q),_q.forEach(s),mq.forEach(s),tC=h(yE),Oc=a(yE,"SPAN",{});var vq=i(Oc);sC=r(vq,"Debugging tests"),vq.forEach(s),yE.forEach(s),$y=h(e),In=a(e,"P",{});var wq=i(In);oC=r(wq,"To start a debugger at the point of the warning, do this:"),wq.forEach(s),Ey=h(e),c(za.$$.fragment,e),gy=h(e),St=a(e,"H2",{class:!0});var $E=i(St);vo=a($E,"A",{id:!0,class:!0,href:!0});var yq=i(vo);Ic=a(yq,"SPAN",{});var $q=i(Ic);c(Ra.$$.fragment,$q),$q.forEach(s),yq.forEach(s),rC=h($E),Tc=a($E,"SPAN",{});var Eq=i(Tc);lC=r(Eq,"Working with github actions workflows"),Eq.forEach(s),$E.forEach(s),by=h(e),Tn=a(e,"P",{});var gq=i(Tn);aC=r(gq,"To trigger a self-push workflow CI job, you must:"),gq.forEach(s),ky=h(e),pe=a(e,"OL",{});var qo=i(pe);Ga=a(qo,"LI",{});var EE=i(Ga);iC=r(EE,"Create a new branch on "),Ac=a(EE,"CODE",{});var bq=i(Ac);nC=r(bq,"transformers"),bq.forEach(s),pC=r(EE," origin (not a fork!)."),EE.forEach(s),fC=h(qo),H=a(qo,"LI",{});var K=i(H);hC=r(K,"The branch name has to start with either "),Dc=a(K,"CODE",{});var kq=i(Dc);uC=r(kq,"ci_"),kq.forEach(s),dC=r(K," or "),qc=a(K,"CODE",{});var Cq=i(qc);cC=r(Cq,"ci-"),Cq.forEach(s),mC=r(K," ("),Sc=a(K,"CODE",{});var jq=i(Sc);_C=r(jq,"main"),jq.forEach(s),vC=r(K,` triggers it too, but we can\u2019t do PRs on
`),Lc=a(K,"CODE",{});var xq=i(Lc);wC=r(xq,"main"),xq.forEach(s),yC=r(K,`). It also gets triggered only for specific paths - you can find the up-to-date definition in case it
changed since this document has been written `),Fa=a(K,"A",{href:!0,rel:!0});var Pq=i(Fa);$C=r(Pq,"here"),Pq.forEach(s),EC=r(K," under "),Uc=a(K,"EM",{});var Oq=i(Uc);gC=r(Oq,"push:"),Oq.forEach(s),K.forEach(s),bC=h(qo),Nc=a(qo,"LI",{});var Iq=i(Nc);kC=r(Iq,"Create a PR from this branch."),Iq.forEach(s),CC=h(qo),Ma=a(qo,"LI",{});var gE=i(Ma);jC=r(gE,"Then you can see the job appear "),Wa=a(gE,"A",{href:!0,rel:!0});var Tq=i(Wa);xC=r(Tq,"here"),Tq.forEach(s),PC=r(gE,`. It may not run right away if there
is a backlog.`),gE.forEach(s),qo.forEach(s),Cy=h(e),Lt=a(e,"H2",{class:!0});var bE=i(Lt);wo=a(bE,"A",{id:!0,class:!0,href:!0});var Aq=i(wo);Hc=a(Aq,"SPAN",{});var Dq=i(Hc);c(Ba.$$.fragment,Dq),Dq.forEach(s),Aq.forEach(s),OC=h(bE),zc=a(bE,"SPAN",{});var qq=i(zc);IC=r(qq,"Testing Experimental CI Features"),qq.forEach(s),bE.forEach(s),jy=h(e),An=a(e,"P",{});var Sq=i(An);TC=r(Sq,`Testing CI features can be potentially problematic as it can interfere with the normal CI functioning. Therefore if a
new CI feature is to be added, it should be done as following.`),Sq.forEach(s),xy=h(e),fe=a(e,"OL",{});var So=i(fe);Rc=a(So,"LI",{});var Lq=i(Rc);AC=r(Lq,"Create a new dedicated job that tests what needs to be tested"),Lq.forEach(s),DC=h(So),Gc=a(So,"LI",{});var Uq=i(Gc);qC=r(Uq,"The new job must always succeed so that it gives us a green \u2713 (details below)."),Uq.forEach(s),SC=h(So),Fc=a(So,"LI",{});var Nq=i(Fc);LC=r(Nq,`Let it run for some days to see that a variety of different PR types get to run on it (user fork branches,
non-forked branches, branches originating from github.com UI direct file edit, various forced pushes, etc. - there
are so many) while monitoring the experimental job\u2019s logs (not the overall job green as it\u2019s purposefully always
green)`),Nq.forEach(s),UC=h(So),Mc=a(So,"LI",{});var Hq=i(Mc);NC=r(Hq,"When it\u2019s clear that everything is solid, then merge the new changes into existing jobs."),Hq.forEach(s),So.forEach(s),Py=h(e),Dn=a(e,"P",{});var zq=i(Dn);HC=r(zq,"That way experiments on CI functionality itself won\u2019t interfere with the normal workflow."),zq.forEach(s),Oy=h(e),qn=a(e,"P",{});var Rq=i(qn);zC=r(Rq,"Now how can we make the job always succeed while the new CI feature is being developed?"),Rq.forEach(s),Iy=h(e),Sn=a(e,"P",{});var Gq=i(Sn);RC=r(Gq,`Some CIs, like TravisCI support ignore-step-failure and will report the overall job as successful, but CircleCI and
Github Actions as of this writing don\u2019t support that.`),Gq.forEach(s),Ty=h(e),Ln=a(e,"P",{});var Fq=i(Ln);GC=r(Fq,"So the following workaround can be used:"),Fq.forEach(s),Ay=h(e),yo=a(e,"OL",{});var kE=i(yo);Un=a(kE,"LI",{});var Ij=i(Un);Wc=a(Ij,"CODE",{});var Mq=i(Wc);FC=r(Mq,"set +euo pipefail"),Mq.forEach(s),MC=r(Ij," at the beginning of the run command to suppress most potential failures in the bash script."),Ij.forEach(s),WC=h(kE),Ut=a(kE,"LI",{});var pp=i(Ut);BC=r(pp,"the last command must be a success: "),Bc=a(pp,"CODE",{});var Wq=i(Bc);YC=r(Wq,'echo "done"'),Wq.forEach(s),VC=r(pp," or just "),Yc=a(pp,"CODE",{});var Bq=i(Yc);XC=r(Bq,"true"),Bq.forEach(s),JC=r(pp," will do"),pp.forEach(s),kE.forEach(s),Dy=h(e),Nn=a(e,"P",{});var Yq=i(Nn);ZC=r(Yq,"Here is an example:"),Yq.forEach(s),qy=h(e),c(Ya.$$.fragment,e),Sy=h(e),Hn=a(e,"P",{});var Vq=i(Hn);KC=r(Vq,"For simple commands you could also do:"),Vq.forEach(s),Ly=h(e),c(Va.$$.fragment,e),Uy=h(e),$o=a(e,"P",{});var CE=i($o);QC=r(CE,`Of course, once satisfied with the results, integrate the experimental step or job with the rest of the normal jobs,
while removing `),Vc=a(CE,"CODE",{});var Xq=i(Vc);ej=r(Xq,"set +euo pipefail"),Xq.forEach(s),tj=r(CE,` or any other things you may have added to ensure that the experimental job doesn\u2019t
interfere with the normal CI functioning.`),CE.forEach(s),Ny=h(e),Eo=a(e,"P",{});var jE=i(Eo);sj=r(jE,"This whole process would have been much easier if we only could set something like "),Xc=a(jE,"CODE",{});var Jq=i(Xc);oj=r(Jq,"allow-failure"),Jq.forEach(s),rj=r(jE,` for the
experimental step, and let it fail without impacting the overall status of PRs. But as mentioned earlier CircleCI and
Github Actions don\u2019t support it at the moment.`),jE.forEach(s),Hy=h(e),zn=a(e,"P",{});var Zq=i(zn);lj=r(Zq,"You can vote for this feature and see where it is at these CI-specific threads:"),Zq.forEach(s),zy=h(e),go=a(e,"UL",{});var xE=i(go);Jc=a(xE,"LI",{});var Kq=i(Jc);Xa=a(Kq,"A",{href:!0,rel:!0});var Qq=i(Xa);aj=r(Qq,"Github Actions:"),Qq.forEach(s),Kq.forEach(s),ij=h(xE),Zc=a(xE,"LI",{});var eS=i(Zc);Ja=a(eS,"A",{href:!0,rel:!0});var tS=i(Ja);nj=r(tS,"CircleCI:"),tS.forEach(s),eS.forEach(s),xE.forEach(s),this.h()},h(){u($,"name","hf:doc:metadata"),u($,"content",JSON.stringify(uS)),u(C,"id","testing"),u(C,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(C,"href","#testing"),u(g,"class","relative group"),u(zt,"id","how-transformers-are-tested"),u(zt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(zt,"href","#how-transformers-are-tested"),u(Ve,"class","relative group"),u(Ho,"href","https://github.com/huggingface/transformers/tree/main/.circleci/config.yml"),u(Ho,"rel","nofollow"),u(Fo,"href","https://github.com/huggingface/transformers/actions"),u(Fo,"rel","nofollow"),u(Mo,"href","https://github.com/huggingface/transformers/tree/main/.github/workflows/github-torch-hub.yml"),u(Mo,"rel","nofollow"),u(Wo,"href","https://github.com/huggingface/transformers/tree/main/.github/workflows/self-push.yml"),u(Wo,"rel","nofollow"),u(Bo,"href","https://github.com/huggingface/transformers/tree/main/.github/workflows/self-scheduled.yml"),u(Bo,"rel","nofollow"),u(Vo,"href","https://github.com/huggingface/transformers/actions"),u(Vo,"rel","nofollow"),u(Ft,"id","running-tests"),u(Ft,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Ft,"href","#running-tests"),u(Je,"class","relative group"),u(Mt,"id","choosing-which-tests-to-run"),u(Mt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Mt,"href","#choosing-which-tests-to-run"),u(Ze,"class","relative group"),u(Zo,"href","https://docs.pytest.org/en/latest/usage.html"),u(Zo,"rel","nofollow"),u(Bt,"id","getting-the-list-of-all-tests"),u(Bt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Bt,"href","#getting-the-list-of-all-tests"),u(Ke,"class","relative group"),u(Yt,"id","run-a-specific-test-module"),u(Yt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Yt,"href","#run-a-specific-test-module"),u(Qe,"class","relative group"),u(Vt,"id","run-specific-tests"),u(Vt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Vt,"href","#run-specific-tests"),u(et,"class","relative group"),u(es,"id","run-only-modified-tests"),u(es,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(es,"href","#run-only-modified-tests"),u(tt,"class","relative group"),u(_r,"href","https://github.com/anapaulagomes/pytest-picked"),u(_r,"rel","nofollow"),u(ss,"id","automatically-rerun-failed-tests-on-source-modification"),u(ss,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ss,"href","#automatically-rerun-failed-tests-on-source-modification"),u(st,"class","relative group"),u(Er,"href","https://github.com/pytest-dev/pytest-xdist"),u(Er,"rel","nofollow"),u(jr,"href","https://github.com/joeyespo/pytest-watch"),u(jr,"rel","nofollow"),u(os,"id","skip-a-test-module"),u(os,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(os,"href","#skip-a-test-module"),u(rt,"class","relative group"),u(ls,"id","clearing-state"),u(ls,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ls,"href","#clearing-state"),u(lt,"class","relative group"),u(as,"id","running-tests-in-parallel"),u(as,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(as,"href","#running-tests-in-parallel"),u(at,"class","relative group"),u(Ar,"href","https://github.com/ESSS/pytest-replay"),u(Ar,"rel","nofollow"),u(is,"id","test-order-and-repetition"),u(is,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(is,"href","#test-order-and-repetition"),u(it,"class","relative group"),u(ns,"id","repeat-tests"),u(ns,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ns,"href","#repeat-tests"),u(nt,"class","relative group"),u(Sr,"href","https://github.com/dropbox/pytest-flakefinder"),u(Sr,"rel","nofollow"),u(hs,"id","run-tests-in-a-random-order"),u(hs,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(hs,"href","#run-tests-in-a-random-order"),u(pt,"class","relative group"),u(Mr,"href","https://github.com/jbasko/pytest-random-order"),u(Mr,"rel","nofollow"),u(Wr,"href","https://github.com/pytest-dev/pytest-randomly"),u(Wr,"rel","nofollow"),u(ms,"id","look-and-feel-variations"),u(ms,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ms,"href","#look-and-feel-variations"),u(ft,"class","relative group"),u(_s,"id","pytestsugar"),u(_s,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(_s,"href","#pytestsugar"),u(ht,"class","relative group"),u(Xr,"href","https://github.com/Frozenball/pytest-sugar"),u(Xr,"rel","nofollow"),u(vs,"id","report-each-subtest-name-and-its-progress"),u(vs,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(vs,"href","#report-each-subtest-name-and-its-progress"),u(ut,"class","relative group"),u(ws,"id","instantly-shows-failed-tests"),u(ws,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ws,"href","#instantly-shows-failed-tests"),u(dt,"class","relative group"),u(sl,"href","https://github.com/pytest-dev/pytest-instafail"),u(sl,"rel","nofollow"),u(ys,"id","to-gpu-or-not-to-gpu"),u(ys,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(ys,"href","#to-gpu-or-not-to-gpu"),u(ct,"class","relative group"),u(xs,"id","distributed-training"),u(xs,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(xs,"href","#distributed-training"),u(mt,"class","relative group"),u(cl,"href","https://github.com/huggingface/transformers/tree/main/tests/test_trainer_distributed.py"),u(cl,"rel","nofollow"),u(ml,"href","https://github.com/huggingface/transformers/tree/main/tests/deepspeed/test_deepspeed.py"),u(ml,"rel","nofollow"),u(Is,"id","output-capture"),u(Is,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Is,"href","#output-capture"),u(vt,"class","relative group"),u(Ts,"id","color-control"),u(Ts,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Ts,"href","#color-control"),u(wt,"class","relative group"),u(As,"id","sending-test-report-to-online-pastebin-service"),u(As,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(As,"href","#sending-test-report-to-online-pastebin-service"),u(yt,"class","relative group"),u(Ds,"id","writing-tests"),u(Ds,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Ds,"href","#writing-tests"),u($t,"class","relative group"),u(jl,"href","https://docs.pytest.org/en/stable/unittest.html"),u(jl,"rel","nofollow"),u(qs,"id","parametrization"),u(qs,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(qs,"href","#parametrization"),u(Et,"class","relative group"),u(ql,"href","https://pypi.org/project/parameterized/"),u(ql,"rel","nofollow"),u(Ns,"id","files-and-directories"),u(Ns,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Ns,"href","#files-and-directories"),u(gt,"class","relative group"),u(Ms,"id","temporary-files-and-directories"),u(Ms,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Ms,"href","#temporary-files-and-directories"),u(bt,"class","relative group"),u(Xs,"id","temporary-syspath-override"),u(Xs,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Xs,"href","#temporary-syspath-override"),u(Ct,"class","relative group"),u(Js,"id","skipping-tests"),u(Js,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Js,"href","#skipping-tests"),u(jt,"class","relative group"),u(Qs,"id","implementation"),u(Qs,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(Qs,"href","#implementation"),u(xt,"class","relative group"),u(ca,"href","https://docs.pytest.org/en/latest/skipping.html"),u(ca,"rel","nofollow"),u(oo,"id","slow-tests"),u(oo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(oo,"href","#slow-tests"),u(Pt,"class","relative group"),u($a,"href","https://github.com/huggingface/transformers/tree/main/scripts/fsmt/fsmt-make-tiny-model.py"),u($a,"rel","nofollow"),u(Ea,"href","https://huggingface.co/stas/tiny-wmt19-en-de"),u(Ea,"rel","nofollow"),u(lo,"id","testing-the-stdoutstderr-output"),u(lo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(lo,"href","#testing-the-stdoutstderr-output"),u(It,"class","relative group"),u(ba,"href","https://docs.pytest.org/en/latest/capture.html"),u(ba,"rel","nofollow"),u(fo,"id","capturing-logger-stream"),u(fo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(fo,"href","#capturing-logger-stream"),u(Tt,"class","relative group"),u(uo,"id","testing-with-environment-variables"),u(uo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(uo,"href","#testing-with-environment-variables"),u(At,"class","relative group"),u(mo,"id","getting-reproducible-results"),u(mo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(mo,"href","#getting-reproducible-results"),u(Dt,"class","relative group"),u(_o,"id","debugging-tests"),u(_o,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(_o,"href","#debugging-tests"),u(qt,"class","relative group"),u(vo,"id","working-with-github-actions-workflows"),u(vo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(vo,"href","#working-with-github-actions-workflows"),u(St,"class","relative group"),u(Fa,"href","https://github.com/huggingface/transformers/blob/main/.github/workflows/self-push.yml"),u(Fa,"rel","nofollow"),u(Wa,"href","https://github.com/huggingface/transformers/actions/workflows/self-push.yml"),u(Wa,"rel","nofollow"),u(wo,"id","testing-experimental-ci-features"),u(wo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(wo,"href","#testing-experimental-ci-features"),u(Lt,"class","relative group"),u(Xa,"href","https://github.com/actions/toolkit/issues/399"),u(Xa,"rel","nofollow"),u(Ja,"href","https://ideas.circleci.com/ideas/CCI-I-344"),u(Ja,"rel","nofollow")},m(e,n){t(document.head,$),p(e,O,n),p(e,g,n),t(g,C),t(C,A),m(j,A,null),t(g,z),t(g,D),t(D,P),p(e,b,n),p(e,S,n),t(S,R),p(e,Nt,n),p(e,ye,n),t(ye,Be),p(e,q,n),p(e,me,n),t(me,Ye),t(Ye,Ht),t(Ht,ti),t(Ye,OE),t(me,IE),t(me,si),t(si,fp),t(fp,TE),t(si,AE),p(e,fm,n),p(e,Ve,n),t(Ve,zt),t(zt,hp),m(Lo,hp,null),t(Ve,DE),t(Ve,up),t(up,qE),p(e,hm,n),p(e,Rt,n),t(Rt,Uo),t(Uo,No),t(No,SE),t(No,Ho),t(Ho,LE),t(No,UE),t(Uo,NE),t(Uo,z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),t(lt,ls),t(ls,hf),m(Or,hf,null),t(lt,h3),t(lt,uf),t(uf,u3),p(e,g_,n),p(e,bi,n),t(bi,d3),p(e,b_,n),m(Ir,e,n),p(e,k_,n),p(e,at,n),t(at,as),t(as,df),m(Tr,df,null),t(at,c3),t(at,cf),t(cf,m3),p(e,C_,n),p(e,M,n),t(M,_3),t(M,mf),t(mf,v3),t(M,w3),t(M,_f),t(_f,y3),t(M,$3),t(M,vf),t(vf,E3),t(M,g3),t(M,wf),t(wf,b3),t(M,k3),p(e,j_,n),p(e,_e,n),t(_e,yf),t(yf,C3),t(_e,j3),t(_e,$f),t($f,x3),t(_e,P3),t(_e,Ef),t(Ef,O3),t(_e,I3),p(e,x_,n),p(e,Ce,n),t(Ce,T3),t(Ce,gf),t(gf,A3),t(Ce,D3),t(Ce,Ar),t(Ar,q3),t(Ce,S3),p(e,P_,n),p(e,it,n),t(it,is),t(is,bf),m(Dr,bf,null),t(it,L3),t(it,kf),t(kf,U3),p(e,O_,n),p(e,ki,n),t(ki,N3),p(e,I_,n),p(e,nt,n),t(nt,ns),t(ns,Cf),m(qr,Cf,null),t(nt,H3),t(nt,jf),t(jf,z3),p(e,T_,n),p(e,Ci,n),t(Ci,ji),t(ji,Sr),t(Sr,R3),t(ji,G3),p(e,A_,n),m(Lr,e,n),p(e,D_,n),p(e,xi,n),t(xi,F3),p(e,q_,n),m(Ur,e,n),p(e,S_,n),m(ps,e,n),p(e,L_,n),m(fs,e,n),p(e,U_,n),p(e,pt,n),t(pt,hs),t(hs,xf),m(Nr,xf,null),t(pt,M3),t(pt,Pf),t(Pf,W3),p(e,N_,n),m(Hr,e,n),p(e,H_,n),p(e,us,n),t(us,B3),t(us,Of),t(Of,Y3),t(us,V3),p(e,z_,n),p(e,ds,n),t(ds,X3),t(ds,If),t(If,J3),t(ds,Z3),p(e,R_,n),m(zr,e,n),p(e,G_,n),p(e,Pi,n),t(Pi,K3),p(e,F_,n),m(Rr,e,n),p(e,M_,n),p(e,cs,n),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e,hv,n),p(e,$s,n),t($s,G2),t($s,Zf),t(Zf,F2),t($s,M2),p(e,uv,n),m(al,e,n),p(e,dv,n),p(e,te,n),t(te,W2),t(te,Kf),t(Kf,B2),t(te,Y2),t(te,Qf),t(Qf,V2),t(te,X2),t(te,eh),t(eh,J2),t(te,Z2),p(e,cv,n),m(il,e,n),p(e,mv,n),p(e,Ai,n),t(Ai,K2),p(e,_v,n),p(e,Di,n),t(Di,Q2),p(e,vv,n),p(e,U,n),t(U,qi),t(qi,th),t(th,e5),t(qi,t5),t(U,s5),t(U,Es),t(Es,sh),t(sh,o5),t(Es,r5),t(Es,oh),t(oh,l5),t(Es,a5),t(U,i5),t(U,gs),t(gs,rh),t(rh,n5),t(gs,p5),t(gs,lh),t(lh,f5),t(gs,h5),t(U,u5),t(U,bs),t(bs,ah),t(ah,d5),t(bs,c5),t(bs,ih),t(ih,m5),t(bs,_5),t(U,v5),t(U,ks),t(ks,nh),t(nh,w5),t(ks,y5),t(ks,ph),t(ph,$5),t(ks,E5),t(U,g5),t(U,Cs),t(Cs,fh),t(fh,b5),t(Cs,k5),t(Cs,hh),t(hh,C5),t(Cs,j5),p(e,wv,n),p(e,Si,n),t(Si,x5),p(e,yv,n),p(e,k,n),t(k,P5),t(k,uh),t(uh,O5),t(k,I5),t(k,dh),t(dh,T5),t(k,A5),t(k,ch),t(ch,D5),t(k,q5),t(k,mh),t(mh,S5),t(k,L5),t(k,_h),t(_h,U5),t(k,N5),t(k,vh),t(vh,H5),t(k,z5),t(k,wh),t(wh,R5),t(k,G5),t(k,yh),t(yh,F5),t(k,M5),t(k,$h),t($h,W5),t(k,B5),t(k,Eh),t(Eh,Y5),t(k,V5),p(e,$v,n),p(e,Li,n),t(Li,X5),p(e,Ev,n),m(nl,e,n),p(e,gv,n),p(e,Pe,n),t(Pe,J5),t(Pe,gh),t(gh,Z5),t(Pe,K5),t(Pe,bh),t(bh,Q5),t(Pe,ek),p(e,bv,n),m(pl,e,n),p(e,kv,n),p(e,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e,v1,n),p(e,B,n),t(B,I4),t(B,ql),t(ql,T4),t(B,A4),t(B,au),t(au,D4),t(B,q4),t(B,iu),t(iu,S4),t(B,L4),t(B,nu),t(nu,U4),t(B,N4),p(e,w1,n),p(e,oe,n),t(oe,H4),t(oe,pu),t(pu,z4),t(oe,R4),t(oe,fu),t(fu,G4),t(oe,F4),t(oe,hu),t(hu,M4),t(oe,W4),p(e,y1,n),p(e,De,n),t(De,B4),t(De,uu),t(uu,Y4),t(De,V4),t(De,du),t(du,X4),t(De,J4),p(e,$1,n),m(Sl,e,n),p(e,E1,n),p(e,re,n),t(re,Z4),t(re,cu),t(cu,K4),t(re,Q4),t(re,mu),t(mu,e0),t(re,t0),t(re,_u),t(_u,s0),t(re,o0),p(e,g1,n),m(Ll,e,n),p(e,b1,n),p(e,Ji,n),t(Ji,r0),p(e,k1,n),m(Ul,e,n),p(e,C1,n),p(e,Zi,n),t(Zi,l0),p(e,j1,n),m(Nl,e,n),p(e,x1,n),p(e,Ki,n),t(Ki,a0),p(e,P1,n),p(e,gt,n),t(gt,Ns),t(Ns,vu),m(Hl,vu,null),t(gt,i0),t(gt,wu),t(wu,n0),p(e,O1,n),p(e,Hs,n),t(Hs,p0),t(Hs,yu),t(yu,f0),t(Hs,h0),p(e,I1,n),p(e,zs,n),t(zs,zl),t(zl,Qi),t(Qi,$u),t($u,u0),t(Qi,d0),t(zl,c0),t(zl,G),t(G,Rl),t(Rl,Eu),t(Eu,m0),t(Rl,_0),t(Rl,gu),t(gu,v0),t(G,w0),t(G,en),t(en,bu),t(bu,y0),t(en,$0),t(G,E0),t(G,Rs),t(Rs,ku),t(ku,g0),t(Rs,b0),t(Rs,Cu),t(Cu,k0),t(Rs,C0),t(G,j0),t(G,Gs),t(Gs,ju),t(ju,x0),t(Gs,P0),t(Gs,xu),t(xu,O0),t(Gs,I0),t(G,T0),t(G,tn),t(tn,Pu),t(Pu,A0),t(tn,D0),t(G,q0),t(G,qe),t(qe,Ou),t(Ou,S0),t(q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,e,n),p(e,Y1,n),p(e,an,n),t(an,q6),p(e,V1,n),p(e,nn,n),t(nn,Zl),t(Zl,kt),t(kt,S6),t(kt,ld),t(ld,L6),t(kt,U6),t(kt,ad),t(ad,N6),t(kt,H6),t(Zl,z6),t(Zl,ve),t(ve,pn),t(pn,id),t(id,R6),t(pn,G6),t(ve,F6),t(ve,fn),t(fn,nd),t(nd,M6),t(fn,W6),t(ve,B6),t(ve,hn),t(hn,pd),t(pd,Y6),t(hn,V6),t(ve,X6),t(ve,un),t(un,fd),t(fd,J6),t(un,Z6),p(e,X1,n),m(Ys,e,n),p(e,J1,n),m(Vs,e,n),p(e,Z1,n),p(e,Ct,n),t(Ct,Xs),t(Xs,hd),m(Kl,hd,null),t(Ct,K6),t(Ct,ud),t(ud,Q6),p(e,K1,n),p(e,Le,n),t(Le,e7),t(Le,dd),t(dd,t7),t(Le,s7),t(Le,cd),t(cd,o7),t(Le,r7),p(e,Q1,n),m(Ql,e,n),p(e,ew,n),p(e,jt,n),t(jt,Js),t(Js,md),m(ea,md,null),t(jt,l7),t(jt,_d),t(_d,a7),p(e,tw,n),p(e,Zs,n),t(Zs,i7),t(Zs,vd),t(vd,n7),t(Zs,p7),p(e,sw,n),p(e,dn,n),t(dn,f7),p(e,ow,n),p(e,Ks,n),t(Ks,wd),t(wd,ta),t(ta,h7),t(ta,yd),t(yd,u7),t(ta,d7),t(Ks,c7),t(Ks,$d),t($d,sa),t(sa,m7),t(sa,Ed),t(Ed,_7),t(sa,v7),p(e,rw,n),p(e,le,n),t(le,w7),t(le,gd),t(gd,y7),t(le,$7),t(le,bd),t(bd,E7),t(le,g7),t(le,kd),t(kd,b7),t(le,k7),p(e,lw,n),p(e,xt,n),t(xt,Qs),t(Qs,Cd),m(oa,Cd,null),t(xt,C7),t(xt,jd),t(jd,j7),p(e,aw,n),p(e,cn,n),t(cn,xd),t(xd,x7),p(e,iw,n),m(ra,e,n),p(e,nw,n),p(e,mn,n),t(mn,P7),p(e,pw,n),m(la,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,n),t(po,w9),t(po,fc),t(fc,y9),t(po,$9),p(e,ry,n),m(Ia,e,n),p(e,ly,n),p(e,Pn,n),t(Pn,E9),p(e,ay,n),p(e,Tt,n),t(Tt,fo),t(fo,hc),m(Ta,hc,null),t(Tt,g9),t(Tt,uc),t(uc,b9),p(e,iy,n),p(e,ho,n),t(ho,k9),t(ho,dc),t(dc,C9),t(ho,j9),p(e,ny,n),m(Aa,e,n),p(e,py,n),p(e,At,n),t(At,uo),t(uo,cc),m(Da,cc,null),t(At,x9),t(At,mc),t(mc,P9),p(e,fy,n),p(e,qa,n),t(qa,O9),t(qa,_c),t(_c,I9),p(e,hy,n),m(Sa,e,n),p(e,uy,n),p(e,ne,n),t(ne,T9),t(ne,vc),t(vc,A9),t(ne,D9),t(ne,wc),t(wc,q9),t(ne,S9),t(ne,yc),t(yc,L9),t(ne,U9),p(e,dy,n),m(La,e,n),p(e,cy,n),p(e,N,n),t(N,N9),t(N,$c),t($c,H9),t(N,z9),t(N,Ec),t(Ec,R9),t(N,G9),t(N,gc),t(gc,F9),t(N,M9),t(N,bc),t(bc,W9),t(N,B9),t(N,kc),t(kc,Y9),t(N,V9),p(e,my,n),p(e,co,n),t(co,X9),t(co,Cc),t(Cc,J9),t(co,Z9),p(e,_y,n),p(e,Dt,n),t(Dt,mo),t(mo,jc),m(Ua,jc,null),t(Dt,K9),t(Dt,xc),t(xc,Q9),p(e,vy,n),p(e,On,n),t(On,eC),p(e,wy,n),m(Na,e,n),p(e,yy,n),p(e,qt,n),t(qt,_o),t(_o,Pc),m(Ha,Pc,null),t(qt,tC),t(qt,Oc),t(Oc,sC),p(e,$y,n),p(e,In,n),t(In,oC),p(e,Ey,n),m(za,e,n),p(e,gy,n),p(e,St,n),t(St,vo),t(vo,Ic),m(Ra,Ic,null),t(St,rC),t(St,Tc),t(Tc,lC),p(e,by,n),p(e,Tn,n),t(Tn,aC),p(e,ky,n),p(e,pe,n),t(pe,Ga),t(Ga,iC),t(Ga,Ac),t(Ac,n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0},p(e,[n]){const Za={};n&2&&(Za.$$scope={dirty:n,ctx:e}),ps.$set(Za);const Kc={};n&2&&(Kc.$$scope={dirty:n,ctx:e}),fs.$set(Kc);const Qc={};n&2&&(Qc.$$scope={dirty:n,ctx:e}),Ys.$set(Qc);const em={};n&2&&(em.$$scope={dirty:n,ctx:e}),Vs.$set(em)},i(e){Ry||(_(j.$$.fragment,e),_(Lo.$$.fragment,e),_(Yo.$$.fragment,e),_(Xo.$$.fragment,e),_(Jo.$$.fragment,e),_(Ko.$$.fragment,e),_(Qo.$$.fragment,e),_(er.$$.fragment,e),_(tr.$$.fragment,e),_(sr.$$.fragment,e),_(or.$$.fragment,e),_(rr.$$.fragment,e),_(lr.$$.fragment,e),_(ar.$$.fragment,e),_(ir.$$.fragment,e),_(nr.$$.fragment,e),_(pr.$$.fragment,e),_(fr.$$.fragment,e),_(hr.$$.fragment,e),_(ur.$$.fragment,e),_(dr.$$.fragment,e),_(cr.$$.fragment,e),_(mr.$$.fragment,e),_(vr.$$.fragment,e),_(wr.$$.fragment,e),_(yr.$$.fragment,e),_(gr.$$.fragment,e),_(br.$$.fragment,e),_(kr.$$.fragment,e),_(xr.$$.fragment,e),_(Pr.$$.fragment,e),_(Or.$$.fragment,e),_(Ir.$$.fragment,e),_(Tr.$$.fragment,e),_(Dr.$$.fragment,e),_(qr.$$.fragment,e),_(Lr.$$.fragment,e),_(Ur.$$.fragment,e),_(ps.$$.fragment,e),_(fs.$$.fragment,e),_(Nr.$$.fragment,e),_(Hr.$$.fragment,e),_(zr.$$.fragment,e),_(Rr.$$.fragment,e),_(Gr.$$.fragment,e),_(Fr.$$.fragment,e),_(Br.$$.fragment,e),_(Yr.$$.fragment,e),_(Jr.$$.fragment,e),_(Zr.$$.fragment,e),_(Kr.$$.fragment,e),_(Qr.$$.fragment,e),_(el.$$.fragment,e),_(ol.$$.fragment,e),_(rl.$$.fragment,e),_(ll.$$.fragment,e),_(al.$$.fragment,e),_(il.$$.fragment,e),_(nl.$$.fragment,e),_(pl.$$.fragment,e),_(fl.$$.fragment,e),_(hl.$$.fragment,e),_(ul.$$.fragment,e),_(dl.$$.fragment,e),_(_l.$$.fragment,e),_(vl.$$.fragment,e),_(wl.$$.fragment,e),_(yl.$$.fragment,e),_($l.$$.fragment,e),_(El.$$.fragment,e),_(gl.$$.fragment,e),_(bl.$$.fragment,e),_(kl.$$.fragment,e),_(Cl.$$.fragment,e),_(xl.$$.fragment,e),_(Pl.$$.fragment,e),_(Ol.$$.fragment,e),_(Il.$$.fragment,e),_(Tl.$$.fragment,e),_(Al.$$.fragment,e),_(Dl.$$.fragment,e),_(Sl.$$.fragment,e),_(Ll.$$.fragment,e),_(Ul.$$.fragment,e),_(Nl.$$.fragment,e),_(Hl.$$.fragment,e),_(Ml.$$.fragment,e),_(Wl.$$.fragment,e),_(Bl.$$.fragment,e),_(Yl.$$.fragment,e),_(Vl.$$.fragment,e),_(Jl.$$.fragment,e),_(Ys.$$.fragment,e),_(Vs.$$.fragment,e),_(Kl.$$.fragment,e),_(Ql.$$.fragment,e),_(ea.$$.fragment,e),_(oa.$$.fragment,e),_(ra.$$.fragment,e),_(la.$$.fragment,e),_(aa.$$.fragment,e),_(ia.$$.fragment,e),_(na.$$.fragment,e),_(pa.$$.fragment,e),_(fa.$$.fragment,e),_(ha.$$.fragment,e),_(ua.$$.fragment,e),_(da.$$.fragment,e),_(ma.$$.fragment,e),_(_a.$$.fragment,e),_(va.$$.fragment,e),_(wa.$$.fragment,e),_(ya.$$.fragment,e),_(ga.$$.fragment,e),_(ka.$$.fragment,e),_(Ca.$$.fragment,e),_(ja.$$.fragment,e),_(xa.$$.fragment,e),_(Pa.$$.fragment,e),_(Oa.$$.fragment,e),_(Ia.$$.fragment,e),_(Ta.$$.fragment,e),_(Aa.$$.fragment,e),_(Da.$$.fragment,e),_(Sa.$$.fragment,e),_(La.$$.fragment,e),_(Ua.$$.fragment,e),_(Na.$$.fragment,e),_(Ha.$$.fragment,e),_(za.$$.fragment,e),_(Ra.$$.fragment,e),_(Ba.$$.fragment,e),_(Ya.$$.fragment,e),_(Va.$$.fragment,e),Ry=!0)},o(e){v(j.$$.fragment,e),v(Lo.$$.fragment,e),v(Yo.$$.fragment,e),v(Xo.$$.fragment,e),v(Jo.$$.fragment,e),v(Ko.$$.fragment,e),v(Qo.$$.fragment,e),v(er.$$.fragment,e),v(tr.$$.fragment,e),v(sr.$$.fragment,e),v(or.$$.fragment,e),v(rr.$$.fragment,e),v(lr.$$.fragment,e),v(ar.$$.fragment,e),v(ir.$$.fragment,e),v(nr.$$.fragment,e),v(pr.$$.fragment,e),v(fr.$$.fragment,e),v(hr.$$.fragment,e),v(ur.$$.fragment,e),v(dr.$$.fragment,e),v(cr.$$.fragment,e),v(mr.$$.fragment,e),v(vr.$$.fragment,e),v(wr.$$.fragment,e),v(yr.$$.fragment,e),v(gr.$$.fragment,e),v(br.$$.fragment,e),v(kr.$$.fragment,e),v(xr.$$.fragment,e),v(Pr.$$.fragment,e),v(Or.$$.fragment,e),v(Ir.$$.fragment,e),v(Tr.$$.fragment,e),v(Dr.$$.fragment,e),v(qr.$$.fragment,e),v(Lr.$$.fragment,e),v(Ur.$$.fragment,e),v(ps.$$.fragment,e),v(fs.$$.fragment,e),v(Nr.$$.fragment,e),v(Hr.$$.fragment,e),v(zr.$$.fragment,e),v(Rr.$$.fragment,e),v(Gr.$$.fragment,e),v(Fr.$$.fragment,e),v(Br.$$.fragment,e),v(Yr.$$.fragment,e),v(Jr.$$.fragment,e),v(Zr.$$.fragment,e),v(Kr.$$.fragment,e),v(Qr.$$.fragment,e),v(el.$$.fragment,e),v(ol.$$.fragment,e),v(rl.$$.fragment,e),v(ll.$$.fragment,e),v(al.$$.fragment,e),v(il.$$.fragment,e),v(nl.$$.fragment,e),v(pl.$$.fragment,e),v(fl.$$.fragment,e),v(hl.$$.fragment,e),v(ul.$$.fragment,e),v(dl.$$.fragment,e),v(_l.$$.fragment,e),v(vl.$$.fragment,e),v(wl.$$.fragment,e),v(yl.$$.fragment,e),v($l.$$.fragment,e),v(El.$$.fragment,e),v(gl.$$.fragment,e),v(bl.$$.fragment,e),v(kl.$$.fragment,e),v(Cl.$$.fragment,e),v(xl.$$.fragment,e),v(Pl.$$.fragment,e),v(Ol.$$.fragment,e),v(Il.$$.fragment,e),v(Tl.$$.fragment,e),v(Al.$$.fragment,e),v(Dl.$$.fragment,e),v(Sl.$$.fragment,e),v(Ll.$$.fragment,e),v(Ul.$$.fragment,e),v(Nl.$$.fragment,e),v(Hl.$$.fragment,e),v(Ml.$$.fragment,e),v(Wl.$$.fragment,e),v(Bl.$$.fragment,e),v(Yl.$$.fragment,e),v(Vl.$$.fragment,e),v(Jl.$$.fragment,e),v(Ys.$$.fragment,e),v(Vs.$$.fragment,e),v(Kl.$$.fragment,e),v(Ql.$$.fragment,e),v(ea.$$.fragment,e),v(oa.$$.fragment,e),v(ra.$$.fragment,e),v(la.$$.fragment,e),v(aa.$$.fragment,e),v(ia.$$.fragment,e),v(na.$$.fragment,e),v(pa.$$.fragment,e),v(fa.$$.fragment,e),v(ha.$$.fragment,e),v(ua.$$.fragment,e),v(da.$$.fragment,e),v(ma.$$.fragment,e),v(_a.$$.fragment,e),v(va.$$.fragment,e),v(wa.$$.fragment,e),v(ya.$$.fragment,e),v(ga.$$.fragment,e),v(ka.$$.fragment,e),v(Ca.$$.fragment,e),v(ja.$$.fragment,e),v(xa.$$.fragment,e),v(Pa.$$.fragment,e),v(Oa.$$.fragment,e),v(Ia.$$.fragment,e),v(Ta.$$.fragment,e),v(Aa.$$.fragment,e),v(Da.$$.fragment,e),v(Sa.$$.fragment,e),v(La.$$.fragment,e),v(Ua.$$.fragment,e),v(Na.$$.fragment,e),v(Ha.$$.fragment,e),v(za.$$.fragment,e),v(Ra.$$.fragment,e),v(Ba.$$.fragment,e),v(Ya.$$.fragment,e),v(Va.$$.fragment,e),Ry=!1},d(e){s($),e&&s(O),e&&s(g),w(j),e&&s(b),e&&s(S),e&&s(Nt),e&&s(ye),e&&s(q),e&&s(me),e&&s(fm),e&&s(Ve),w(Lo),e&&s(hm),e&&s(Rt),e&&s(um),w(Yo,e),e&&s(dm),e&&s(Gt),e&&s(cm),e&&s(Je),w(Xo),e&&s(mm),e&&s(Ze),w(Jo),e&&s(_m),e&&s(Wt),e&&s(vm),e&&s(ri),e&&s(wm),e&&s(li),e&&s(ym),w(Ko,e),e&&s($m),e&&s(ai),e&&s(Em),w(Qo,e),e&&s(gm),e&&s(ii),e&&s(bm),w(er,e),e&&s(km),e&&s(ni),e&&s(Cm),e&&s(Q),e&&s(jm),e&&s(Ke),w(tr),e&&s(xm),e&&s(pi),e&&s(Pm),w(sr,e),e&&s(Om),e&&s(fi),e&&s(Im),w(or,e),e&&s(Tm),e&&s(Qe),w(rr),e&&s(Am),e&&s(hi),e&&s(Dm),w(lr,e),e&&s(qm),e&&s(et),w(ar),e&&s(Sm),e&&s(ui),e&&s(Lm),w(ir,e),e&&s(Um),e&&s(di),e&&s(Nm),e&&s(Ee),e&&s(Hm),e&&s(vi),e&&s(zm),w(nr,e),e&&s(Rm),e&&s(wi),e&&s(Gm),e&&s(Xt),e&&s(Fm),w(pr,e),e&&s(Mm),e&&s(yi),e&&s(Wm),e&&s(Jt),e&&s(Bm),w(fr,e),e&&s(Ym),e&&s(ee),e&&s(Vm),e&&s(Zt),e&&s(Xm),w(hr,e),e&&s(Jm),e&&s($i),e&&s(Zm),w(ur,e),e&&s(Km),e&&s(ge),e&&s(Qm),w(dr,e),e&&s(e_),e&&s(Kt),e&&s(t_),e&&s(Qt),e&&s(s_),w(cr,e),e&&s(o_),e&&s(tt),w(mr),e&&s(r_),e&&s(ts),e&&s(l_),w(vr,e),e&&s(a_),w(wr,e),e&&s(i_),e&&s(Ei),e&&s(n_),e&&s(st),w(yr),e&&s(p_),e&&s($r),e&&s(f_),w(gr,e),e&&s(h_),e&&s(ot),e&&s(u_),e&&s(be),e&&s(d_),w(br,e),e&&s(c_),e&&s(ke),e&&s(m_),w(kr,e),e&&s(__),e&&s(gi),e&&s(v_),e&&s(Cr),e&&s(w_),e&&s(rt),w(xr),e&&s(y_),e&&s(rs),e&&s($_),w(Pr,e),e&&s(E_),e&&s(lt),w(Or),e&&s(g_),e&&s(bi),e&&s(b_),w(Ir,e),e&&s(k_),e&&s(at),w(Tr),e&&s(C_),e&&s(M),e&&s(j_),e&&s(_e),e&&s(x_),e&&s(Ce),e&&s(P_),e&&s(it),w(Dr),e&&s(O_),e&&s(ki),e&&s(I_),e&&s(nt),w(qr),e&&s(T_),e&&s(Ci),e&&s(A_),w(Lr,e),e&&s(D_),e&&s(xi),e&&s(q_),w(Ur,e),e&&s(S_),w(ps,e),e&&s(L_),w(fs,e),e&&s(U_),e&&s(pt),w(Nr),e&&s(N_),w(Hr,e),e&&s(H_),e&&s(us),e&&s(z_),e&&s(ds),e&&s(R_),w(zr,e),e&&s(G_),e&&s(Pi),e&&s(F_),w(Rr,e),e&&s(M_),e&&s(cs),e&&s(W_),w(Gr,e),e&&s(B_),e&&s(Oi),e&&s(Y_),w(Fr,e),e&&s(V_),e&&s(I),e&&s(X_),e&&s(je),e&&s(J_),e&&s(ft),w(Br),e&&s(Z_),e&&s(ht),w(Yr),e&&s(K_),e&&s(Vr),e&&s(Q_),w(Jr,e),e&&s(ev),e&&s(Ii),e&&s(tv),w(Zr,e),e&&s(sv),e&&s(Ti),e&&s(ov),e&&s(ut),w(Kr),e&&s(rv),e&&s(xe),e&&s(lv),w(Qr,e),e&&s(av),e&&s(dt),w(el),e&&s(iv),e&&s(tl),e&&s(nv),w(ol,e),e&&s(pv),w(rl,e),e&&s(fv),e&&s(ct),w(ll),e&&s(hv),e&&s($s),e&&s(uv),w(al,e),e&&s(dv),e&&s(te),e&&s(cv),w(il,e),e&&s(mv),e&&s(Ai),e&&s(_v),e&&s(Di),e&&s(vv),e&&s(U),e&&s(wv),e&&s(Si),e&&s(yv),e&&s(k),e&&s($v),e&&s(Li),e&&s(Ev),w(nl,e),e&&s(gv),e&&s(Pe),e&&s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e&&s(Hs),e&&s(I1),e&&s(zs),e&&s(T1),e&&s(Fs),e&&s(A1),w(Ml,e),e&&s(D1),e&&s(Y),e&&s(q1),w(Wl,e),e&&s(S1),e&&s(bt),w(Bl),e&&s(L1),e&&s(Ws),e&&s(U1),e&&s(sn),e&&s(N1),e&&s(Se),e&&s(H1),e&&s(on),e&&s(z1),w(Yl,e),e&&s(R1),e&&s(Bs),e&&s(G1),e&&s(rn),e&&s(F1),w(Vl,e),e&&s(M1),e&&s(Xl),e&&s(W1),e&&s(ln),e&&s(B1),w(Jl,e),e&&s(Y1),e&&s(an),e&&s(V1),e&&s(nn),e&&s(X1),w(Ys,e),e&&s(J1),w(Vs,e),e&&s(Z1),e&&s(Ct),w(Kl),e&&s(K1),e&&s(Le),e&&s(Q1),w(Ql,e),e&&s(ew),e&&s(jt),w(ea),e&&s(tw),e&&s(Zs),e&&s(sw),e&&s(dn),e&&s(ow),e&&s(Ks),e&&s(rw),e&&s(le),e&&s(lw),e&&s(xt),w(oa),e&&s(aw),e&&s(cn),e&&s(iw),w(ra,e),e&&s(nw),e&&s(mn),e&&s(pw),w(la,e),e&&s(fw),e&&s(eo),e&&s(hw),w(aa,e),e&&s(uw),e&&s(_n),e&&s(dw),w(ia,e),e&&s(cw),e&&s(vn),e&&s(mw),w(na,e),e&&s(_w),e&&s(to),e&&s(vw),w(pa,e),e&&s(ww),e&&s(wn),e&&s(yw),w(fa,e),e&&s($w),e&&s(yn),e&&s(Ew),w(ha,e),e&&s(gw),e&&s($n),e&&s(bw),w(ua,e),e&&s(kw),e&&s(En),e&&s(Cw),w(da,e),e&&s(jw),e&&s(so),e&&s(xw),e&&s(Pt),w(ma),e&&s(Pw),e&&s(gn),e&&s(Ow),w(_a,e),e&&s(Iw),e&&s(Ue),e&&s(Tw),w(va,e),e&&s(Aw),e&&s(ae),e&&s(Dw),w(wa,e),e&&s(qw),e&&s(bn),e&&s(Sw),e&&s(kn),e&&s(Lw),e&&s(Cn),e&&s(Uw),e&&s(ie),e&&s(Nw),e&&s(Ne),e&&s(Hw),w(ya,e),e&&s(zw),e&&s(He),e&&s(Rw),e&&s(ro),e&&s(Gw),e&&s(jn),e&&s(Fw),e&&s(It),w(ga),e&&s(Mw),e&&s(V),e&&s(Ww),w(ka,e),e&&s(Bw),e&&s(ao),e&&s(Yw),w(Ca,e),e&&s(Vw),e&&s(io),e&&s(Xw),w(ja,e),e&&s(Jw),e&&s(T),e&&s(Zw),e&&s(no),e&&s(Kw),w(xa,e),e&&s(Qw),e&&s(xn),e&&s(ey),w(Pa,e),e&&s(ty),e&&s(ze),e&&s(sy),w(Oa,e),e&&s(oy),e&&s(po),e&&s(ry),w(Ia,e),e&&s(ly),e&&s(Pn),e&&s(ay),e&&s(Tt),w(Ta),e&&s(iy),e&&s(ho),e&&s(ny),w(Aa,e),e&&s(py),e&&s(At),w(Da),e&&s(fy),e&&s(qa),e&&s(hy),w(Sa,e),e&&s(uy),e&&s(ne),e&&s(dy),w(La,e),e&&s(cy),e&&s(N),e&&s(my),e&&s(co),e&&s(_y),e&&s(Dt),w(Ua),e&&s(vy),e&&s(On),e&&s(wy),w(Na,e),e&&s(yy),e&&s(qt),w(Ha),e&&s($y),e&&s(In),e&&s(Ey),w(za,e),e&&s(gy),e&&s(St),w(Ra),e&&s(by),e&&s(Tn),e&&s(ky),e&&s(pe),e&&s(Cy),e&&s(Lt),w(Ba),e&&s(jy),e&&s(An),e&&s(xy),e&&s(fe),e&&s(Py),e&&s(Dn),e&&s(Oy),e&&s(qn),e&&s(Iy),e&&s(Sn),e&&s(Ty),e&&s(Ln),e&&s(Ay),e&&s(yo),e&&s(Dy),e&&s(Nn),e&&s(qy),w(Ya,e),e&&s(Sy),e&&s(Hn),e&&s(Ly),w(Va,e),e&&s(Uy),e&&s($o),e&&s(Ny),e&&s(Eo),e&&s(Hy),e&&s(zn),e&&s(zy),e&&s(go)}}}const uS={local:"testing",sections:[{local:"how-transformers-are-tested",title:"How transformers are tested"},{local:"running-tests",sections:[{local:"choosing-which-tests-to-run",title:"Choosing which tests to run"},{local:"getting-the-list-of-all-tests",title:"Getting the list of all tests"},{local:"run-a-specific-test-module",title:"Run a specific test module"},{local:"run-specific-tests",title:"Run specific tests"},{local:"run-only-modified-tests",title:"Run only modified tests"},{local:"automatically-rerun-failed-tests-on-source-modification",title:"Automatically rerun failed tests on source modification"},{local:"skip-a-test-module",title:"Skip a test module"},{local:"clearing-state",title:"Clearing state"},{local:"running-tests-in-parallel",title:"Running tests in parallel"},{local:"test-order-and-repetition",sections:[{local:"repeat-tests",title:"Repeat tests"},{local:"run-tests-in-a-random-order",title:"Run tests in a random order"}],title:"Test order and repetition"},{local:"look-and-feel-variations",sections:[{local:"pytestsugar",title:"pytest-sugar"},{local:"report-each-subtest-name-and-its-progress",title:"Report each sub-test name and its progress"},{local:"instantly-shows-failed-tests",title:"Instantly shows failed tests"}],title:"Look and feel variations"},{local:"to-gpu-or-not-to-gpu",title:"To GPU or not to GPU"},{local:"distributed-training",title:"Distributed training"},{local:"output-capture",title:"Output capture"},{local:"color-control",title:"Color control"},{local:"sending-test-report-to-online-pastebin-service",title:"Sending test report to online pastebin service"}],title:"Running tests"},{local:"writing-tests",sections:[{local:"parametrization",title:"Parametrization"},{local:"files-and-directories",title:"Files and directories"},{local:"temporary-files-and-directories",title:"Temporary files and directories"},{local:"temporary-syspath-override",title:"Temporary sys.path override"},{local:"skipping-tests",sections:[{local:"implementation",title:"Implementation"}],title:"Skipping tests"},{local:"slow-tests",title:"Slow tests"},{local:"testing-the-stdoutstderr-output",title:"Testing the stdout/stderr output"},{local:"capturing-logger-stream",title:"Capturing logger stream"},{local:"testing-with-environment-variables",title:"Testing with environment variables"},{local:"getting-reproducible-results",title:"Getting reproducible results"},{local:"debugging-tests",title:"Debugging tests"}],title:"Writing tests"},{local:"working-with-github-actions-workflows",title:"Working with github actions workflows"},{local:"testing-experimental-ci-features",title:"Testing Experimental CI Features"}],title:"Testing"};function dS(we){return aS(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wS extends sS{constructor($){super();oS(this,$,dS,hS,rS,{})}}export{wS as default,uS as metadata};
