forked from timvideos/gst-switch
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exception handling for Server.run and py.tests
- Loading branch information
Showing
4 changed files
with
45 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
class Error(Exception): | ||
"""docstring for Error""" | ||
class PathError(Exception): | ||
"""docstring for PathError""" | ||
def __init__(self): | ||
pass | ||
|
||
|
||
class ServerProcessError(object): | ||
"""docstring for ServerProcessError""" | ||
def __init__(self): | ||
super(Error, self).__init__() | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from server import Server | ||
import pytest | ||
from exception import * | ||
|
||
|
||
class TestRun(object): | ||
|
||
def test_invalid_path(self): | ||
path = '/usr/' | ||
s = Server(path=path) | ||
with pytest.raises(PathError): | ||
s.run() | ||
|
||
def test_normal(self): | ||
path = '/home/hyades/gst/master/gstreamer/tools/' | ||
s = Server(path=path) | ||
s.run() | ||
assert s.proc is not None | ||
s.terminate() |