Skip to content

Commit

Permalink
Fix unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrippa committed Nov 19, 2012
1 parent a7424b4 commit f3f3d1c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ python:
script: python setup.py test
install:
- sudo apt-get install rtmpdump
- sudo pip install requests sh argparse
- sudo pip install requests==0.14.1 sh argparse
10 changes: 9 additions & 1 deletion tests/test_log.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import unittest

from livestreamer.logger import Logger
from io import StringIO
from livestreamer.compat import is_py2

# Docs says StringIO is suppose to take non-unicode strings
# but it doesn't, so let's use BytesIO instead there...

if is_py2:
from io import BytesIO as StringIO
else:
from io import StringIO

class TestSession(unittest.TestCase):
def setUp(self):
Expand Down
14 changes: 7 additions & 7 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def test_builtin_plugins(self):
def test_resolve_url(self):
plugins = self.session.get_plugins()
channel = self.session.resolve_url("http://test.se/channel")
self.assertIsInstance(channel, Plugin)
self.assertIsInstance(channel, plugins["testplugin"])
self.assertTrue(isinstance(channel, Plugin))
self.assertTrue(isinstance(channel, plugins["testplugin"]))

def test_options(self):
self.session.set_option("test_option", "option")
Expand All @@ -50,11 +50,11 @@ def test_plugin(self):
streams = channel.get_streams()

self.assertTrue("best" in streams)
self.assertIs(streams["best"], streams["1080p"])
self.assertIsInstance(streams["rtmp"], RTMPStream)
self.assertIsInstance(streams["http"], HTTPStream)
self.assertIsInstance(streams["hls"], HLSStream)
self.assertIsInstance(streams["akamaihd"], AkamaiHDStream)
self.assertTrue(streams["best"] is streams["1080p"])
self.assertTrue(isinstance(streams["rtmp"], RTMPStream))
self.assertTrue(isinstance(streams["http"], HTTPStream))
self.assertTrue(isinstance(streams["hls"], HLSStream))
self.assertTrue(isinstance(streams["akamaihd"], AkamaiHDStream))

if __name__ == "__main__":
unittest.main()

0 comments on commit f3f3d1c

Please sign in to comment.