Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix unit tests.

  • Loading branch information...
commit f3f3d1c1f2448764693de765560ffa986a6a311d 1 parent a7424b4
@chrippa authored
Showing with 17 additions and 9 deletions.
  1. +1 −1  .travis.yml
  2. +9 −1 tests/test_log.py
  3. +7 −7 tests/test_session.py
View
2  .travis.yml
@@ -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
View
10 tests/test_log.py
@@ -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):
View
14 tests/test_session.py
@@ -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")
@@ -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()
Please sign in to comment.
Something went wrong with that request. Please try again.