<s> import py <EOL> from py . __ . test . looponfail . remote import LooponfailingSession , LoopState , RemoteControl <EOL> class TestRemoteControl : <EOL> def test_nofailures ( self , testdir ) : <EOL> item = testdir . getitem ( "<STR_LIT>" ) <EOL> control = RemoteControl ( item . config ) <EOL> control . setup ( ) <EOL> failures = control . runsession ( ) <EOL> assert not failures <EOL> def test_failures_somewhere ( self , testdir ) : <EOL> item = testdir . getitem ( "<STR_LIT>" ) <EOL> control = RemoteControl ( item . config ) <EOL> control . setup ( ) <EOL> failures = control . runsession ( ) <EOL> assert failures <EOL> control . setup ( ) <EOL> item . fspath . write ( "<STR_LIT>" ) <EOL> pyc = item . fspath . new ( ext = "<STR_LIT>" ) <EOL> if pyc . check ( ) : <EOL> pyc . remove ( ) <EOL> failures = control . runsession ( failures ) <EOL> assert not failures <EOL> def test_failure_change ( self , testdir ) : <EOL> modcol = testdir . getitem ( """<STR_LIT>""" ) <EOL> control = RemoteControl ( modcol . config ) <EOL> control . setup ( ) <EOL> failures = control . runsession ( ) <EOL> assert failures <EOL> control . setup ( ) <EOL> modcol . fspath . write ( py . code . Source ( """<STR_LIT>""" ) ) <EOL> pyc = modcol . fspath . new ( ext = "<STR_LIT>" ) <EOL> if pyc . check ( ) : <EOL> pyc . remove ( ) <EOL> failures = control . runsession ( failures ) <EOL> assert not failures <EOL> control . setup ( ) <EOL> failures = control . runsession ( ) <EOL> assert failures <EOL> assert str ( failures ) . find ( "<STR_LIT>" ) != - <NUM_LIT:1> <EOL> class TestLooponFailing : <EOL> def test_looponfail_from_fail_to_ok ( self , testdir ) : <EOL> modcol = testdir . getmodulecol ( """<STR_LIT>""" ) <EOL> session = LooponfailingSession ( modcol . config ) <EOL> loopstate = LoopState ( ) <EOL> session . remotecontrol . setup ( ) <EOL> session . loop_once ( loopstate ) <EOL> assert len ( loopstate . colitems ) == <NUM_LIT:1> <EOL> modcol . fspath . write ( py . code . Source ( """<STR_LIT>""" ) ) <EOL> assert session . statrecorder . check ( ) <EOL> session . loop_once ( loopstate ) <EOL> assert not loopstate . colitems <EOL> def test_looponfail_from_one_to_two_tests ( self , testdir ) : <EOL> modcol = testdir . getmodulecol ( """<STR_LIT>""" ) <EOL> session = LooponfailingSession ( modcol . config ) <EOL> loopstate = LoopState ( ) <EOL> session . remotecontrol . setup ( ) <EOL> loopstate . colitems = [ ] <EOL> session . loop_once ( loopstate ) <EOL> assert len ( loopstate . colitems ) == <NUM_LIT:1> <EOL> modcol . fspath . write ( py . code . Source ( """<STR_LIT>""" ) ) <EOL> assert session . statrecorder . check ( ) <EOL> session . loop_once ( loopstate ) <EOL> assert len ( loopstate . colitems ) == <NUM_LIT:0> <EOL> session . loop_once ( loopstate ) <EOL> assert len ( loopstate . colitems ) == <NUM_LIT:1> <EOL> def test_looponfail_removed_test ( self , testdir ) : <EOL> modcol = testdir . getmodulecol ( """<STR_LIT>""" ) <EOL> session = LooponfailingSession ( modcol . config ) <EOL> loopstate = LoopState ( ) <EOL> session . remotecontrol . setup ( ) <EOL> loopstate . colitems = [ ] <EOL> session . loop_once ( loopstate ) <EOL> assert len ( loopstate . colitems ) == <NUM_LIT:2> <EOL> modcol . fspath . write ( py . code . Source ( """<STR_LIT>""" ) ) <EOL> assert session . statrecorder . check ( ) <EOL> session . loop_once ( loopstate ) <EOL> assert len ( loopstate . colitems ) == <NUM_LIT:0> <EOL> session . loop_once ( loopstate ) <EOL> assert len ( loopstate . colitems ) == <NUM_LIT:1> </s>
