Commit ee6f97de authored by legoc's avatar legoc

Added test stream in Python

parent d17a456c
......@@ -142,6 +142,7 @@ public class TestSelector {
apps.add("testresponderpy");
apps.add("testrequesterpy");
apps.add("testcancelpy");
apps.add("teststreampy");
return apps;
}
......
import sys
import time
import cameopy
this = cameopy.This
this.init(sys.argv)
this.setRunning()
for i in range(20):
print("Printing " + str(i))
time.sleep(0.1)
print("Finished the application")
import sys
import time
import threading
import cameopy
def printOutput(socket):
while True:
output = socket.receive()
if output:
print(output.getMessage())
else:
return
this = cameopy.This
this.init(sys.argv)
server = this.getServer()
app = server.start("streampy", cameopy.OUTPUTSTREAM)
socket = app.getOutputStreamSocket()
# Start thread.
t = threading.Thread(target=printOutput, args=(socket,))
t.start()
time.sleep(1)
print("Canceling output")
socket.cancel()
t.join()
state = app.waitFor()
print("Finished the application")
......@@ -303,6 +303,14 @@
<application name="testcancelpy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="python3" args="-u python/tests/testcancel.py"/>
</application>
<application name="streampy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="python3" args="-u python/tests/stream.py"/>
</application>
<application name="teststreampy" starting_time="0" stopping_time="1" output_stream="yes" log_directory="logs" multiple="no" restart="no">
<start executable="python3" args="-u python/tests/teststream.py"/>
</application>
</applications>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment