Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
def agent():
    return cl1.new_default_agent()
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
def agent():
    return cl1.new_default_agent()
Ejemplo n.º 8
0
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)