<s> from pytest import fixture , skip , PLATFORM <EOL> if PLATFORM == '<STR_LIT:win32>' : <EOL> skip ( '<STR_LIT>' ) <EOL> from circuits import Component , Event <EOL> from circuits . net . events import close <EOL> from circuits . node import Node , remote <EOL> from circuits . net . sockets import UDPServer <EOL> class App ( Component ) : <EOL> ready = False <EOL> value = False <EOL> disconnected = False <EOL> def foo ( self ) : <EOL> return '<STR_LIT>' <EOL> def ready ( self , * args ) : <EOL> self . ready = True <EOL> def disconnect ( self , component ) : <EOL> self . disconnected = True <EOL> def remote_value_changed ( self , value ) : <EOL> self . value = True <EOL> @ fixture ( ) <EOL> def bind ( request , manager , watcher ) : <EOL> server = UDPServer ( <NUM_LIT:0> ) . register ( manager ) <EOL> assert watcher . wait ( '<STR_LIT>' ) <EOL> host , port = server . host , server . port <EOL> server . fire ( close ( ) ) <EOL> assert watcher . wait ( '<STR_LIT>' ) <EOL> server . unregister ( ) <EOL> assert watcher . wait ( '<STR_LIT>' ) <EOL> return host , port <EOL> @ fixture ( ) <EOL> def app ( request , manager , watcher , bind ) : <EOL> app = App ( ) . register ( manager ) <EOL> node = Node ( ) . register ( app ) <EOL> watcher . wait ( '<STR_LIT>' ) <EOL> child = ( App ( ) + Node ( port = bind [ <NUM_LIT:1> ] , server_ip = bind [ <NUM_LIT:0> ] ) ) <EOL> child . start ( process = True ) <EOL> node . add ( '<STR_LIT>' , * bind ) <EOL> watcher . wait ( '<STR_LIT>' ) <EOL> def finalizer ( ) : <EOL> child . stop ( ) <EOL> request . addfinalizer ( finalizer ) <EOL> return app <EOL> def test_return_value ( app , watcher ) : <EOL> event = Event . create ( '<STR_LIT:foo>' ) <EOL> event . notify = True <EOL> remote_event = remote ( event , '<STR_LIT>' ) <EOL> remote_event . notify = True <EOL> value = app . fire ( remote_event ) <EOL> assert watcher . wait ( '<STR_LIT>' ) <EOL> assert value . value == '<STR_LIT>' </s>
