summaryrefslogtreecommitdiff
path: root/mpv-test.py
diff options
context:
space:
mode:
authorjaseg <githubaccount@jaseg.net>2017-05-21 13:16:32 +0200
committerGitHub <noreply@github.com>2017-05-21 13:16:32 +0200
commit627d6a938b08e2ce0da27c58483db4af75a570ad (patch)
tree6e953ac618bdedc656dcfbd09fc83a76fd9417dc /mpv-test.py
parent5ca3a0250cd52d01e949d7f998c49db32480b1ca (diff)
parentb1f81ac56184a172f093b0a640890de9ded405d7 (diff)
downloadpython-mpv-627d6a938b08e2ce0da27c58483db4af75a570ad.tar.gz
python-mpv-627d6a938b08e2ce0da27c58483db4af75a570ad.tar.bz2
python-mpv-627d6a938b08e2ce0da27c58483db4af75a570ad.zip
Merge pull request #28 from Matt-Deacalion/fix-unobserve-runtime-error
Fix `unobserve_property` RuntimeError
Diffstat (limited to 'mpv-test.py')
-rwxr-xr-xmpv-test.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/mpv-test.py b/mpv-test.py
index b2bea2e..21cb8cf 100755
--- a/mpv-test.py
+++ b/mpv-test.py
@@ -206,5 +206,32 @@ class TestLifecycle(unittest.TestCase):
handler.assert_any_call('info', 'cplayer', 'Playing: ./test.webm')
+class RegressionTests(unittest.TestCase):
+
+ def test_unobserve_property_runtime_error(self):
+ """
+ Ensure a `RuntimeError` is not thrown within
+ `unobserve_property`.
+ """
+ handler = mock.Mock()
+ handler.observed_mpv_properties = []
+
+ m = mpv.MPV()
+ m.observe_property('loop', handler)
+
+ try:
+ m.unobserve_property('loop', handler)
+ except RuntimeError:
+ self.fail(
+ """
+ "RuntimeError" exception thrown within
+ `unobserve_property`
+ """,
+ )
+ finally:
+ m.terminate()
+
+
+
if __name__ == '__main__':
unittest.main()