Skip to content

Commit

Permalink
exceptions for run, terminate and kill
Browse files Browse the repository at this point in the history
  • Loading branch information
hyades committed Jul 19, 2013
1 parent 51dada1 commit af1bd7c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python-api/gstswitch/server.py
Expand Up @@ -27,6 +27,8 @@ def __init__(self, path, video_port=3000, audio_port=4000, control_port=5000, re
self.audio_port = audio_port
self.control_port = control_port
self.record_file = record_file
self.proc = None
self.pid = -1

def run(self, gst_option=''):
"""Launches the server process
Expand All @@ -36,8 +38,7 @@ def run(self, gst_option=''):
Should be added with spaces between them
:returns: nothing
"""
self.proc = None
self.pid = -1

self.gst_option_string = gst_option
print "Starting server"
self.proc = self._run_process()
Expand Down
9 changes: 9 additions & 0 deletions python-api/gstswitch/test_server.py
Expand Up @@ -17,3 +17,12 @@ def test_normal(self):
s.run()
assert s.proc is not None
s.terminate()

def test_terminate(self):
path = '/home/hyades/gst/master/gstreamer/tools/'
s = Server(path=path)
with pytest.raises(ServerProcessError):
s.terminate()

# def test_kill(self):
# pass

0 comments on commit af1bd7c

Please sign in to comment.