def test_stream_source_to_textfile_explicit(lsource): agent = cl1.new_default_agent() with open("mydata.fmf", "w") as handle: # a cl1.FileLikeDestination simply writes all received packets # to a given file like object (handle) dest = cl1.FileLikeDestination(handle) agent.transmit(lsource, dest)
def test_stream_source_to_textfile_explicit(lsource): agent = cl1.new_default_agent() with open('mydata.fmf', 'w') as handle: # a cl1.FileLikeDestination simply writes all received packets # to a given file like object (handle) dest = cl1.FileLikeDestination(handle) agent.transmit(lsource, dest)
def prepare_stream(protocol): agent = cl1.new_default_agent() _prtcl = protocol class NoOpDestination(streamlib.Destination): protocol = _prtcl receive_packet = lambda self, packet, context: None stream = agent.new_stream(NoOpDestination()) stream.set_protocol(protocol) return stream
def agent(): return cl1.new_default_agent()
def test_stream_source_to_textfile_explicit_alternative(lsource): agent = cl1.new_default_agent() with open("mydata.fmf", "w") as handle: dest = cl1.FileLikeDestination(handle) stream = agent.new_stream(dest) lsource.inject_into(stream)
def test_stream_source_to_textfile_explicit_alternative(lsource): agent = cl1.new_default_agent() with open('mydata.fmf', 'w') as handle: dest = cl1.FileLikeDestination(handle) stream = agent.new_stream(dest) lsource.inject_into(stream)