From b5bf6c1a44fa5daab37b1f9b2e96a6ec969c294c Mon Sep 17 00:00:00 2001 From: Thomas Recouvreux Date: Fri, 20 Sep 2013 11:22:48 -0400 Subject: [PATCH] fix tests --- .travis.yml | 1 + python3/tests/test_server.py | 10 +++++----- python3/zerobot/ioadapters/arduino.py | 13 +++++++------ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 81f9622..8a4c15c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,5 +5,6 @@ python: install: "pip install -r python3/requirements.txt --use-mirrors" # command to run tests before_script: + - python -c "import zmq; print(zmq.zmq_version()); print(zmq.pyzmq_version());" - cd python3 script: tests/runall.py diff --git a/python3/tests/test_server.py b/python3/tests/test_server.py index 19c03e5..4a48e2a 100644 --- a/python3/tests/test_server.py +++ b/python3/tests/test_server.py @@ -44,11 +44,11 @@ def test_launch(self): class BaseServerAndClientsTestCase(BaseServerTestCase): def setUp(self): - client1 = self.BasicClient("Client-1", "tcp://*:%s"%self.FRONTEND_PORT, - "tcp://*:%s"%self.EV_PUBLISHER) - client2 = self.BasicClient("Client-2", "tcp://*:%s"%self.BACKEND_PORT, - ev_push_addr="tcp://*:%s"%self.EV_PULLER) - client3 = self.BasicClient("Client-3", "tcp://*:%s"%self.BACKEND_PORT) + client1 = self.BasicClient("Client-1", "tcp://localhost:%s"%self.FRONTEND_PORT, + "tcp://localhost:%s"%self.EV_PUBLISHER) + client2 = self.BasicClient("Client-2", "tcp://localhost:%s"%self.BACKEND_PORT, + ev_push_addr="tcp://localhost:%s"%self.EV_PULLER) + client3 = self.BasicClient("Client-3", "tcp://localhost:%s"%self.BACKEND_PORT) client1.start(False) client2.start(False) client3.start(False) diff --git a/python3/zerobot/ioadapters/arduino.py b/python3/zerobot/ioadapters/arduino.py index b90f942..17596bc 100644 --- a/python3/zerobot/ioadapters/arduino.py +++ b/python3/zerobot/ioadapters/arduino.py @@ -216,10 +216,6 @@ def process_sock_to_io(self, msg): help_msg = self.help(request) response = Response(request.uid, help_msg, None) self.send_multipart([remote_id, response.pack()]) - elif request.fct == 'kill': - resp = Response(request.uid, 'goobye', None) - self.send_multipart([remote_id, response.pack()]) - quit() # sinon c'est un appel a une fonction else: uid = request.uid @@ -238,12 +234,17 @@ def process_sock_to_io(self, msg): err['error'] = str(ex) response = Response(request.uid, None, err) self.send_multipart([remote_id, response.pack()]) - + + def kill(self, request): + resp = Response(request.uid, 'goobye', None) + self.send_multipart([remote_id, response.pack()]) + quit() + def help(self, request): if not request.args: return '\n'.join(( str(v) for v in self.functions.values())) else: - return self.functions[request.args[0]].__doc__ + ['kill'] + return self.functions[request.args[0]].__doc__ def load_protocol_from_file(self, protocol_file, prefix, prefix_erreur): """