From 3036f64b68207d74a06efcfbc2fdac91a6a70bbc Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sun, 30 Apr 2023 17:02:29 +0200 Subject: Replace xvfbwrapper with PyVirtualDisplay Fixes #249 --- pyproject.toml | 2 +- tests/requirements.txt | 2 +- tests/test_mpv.py | 32 ++++++++++++++++---------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6d1bc3d..a72cd8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,4 +36,4 @@ homepage = "https://github.com/jaseg/python-mpv" [project.optional-dependencies] screenshot_raw = ["Pillow"] -test = ['xvfbwrapper'] +test = ['PyVirtualDisplay'] diff --git a/tests/requirements.txt b/tests/requirements.txt index 4a9b79c..ded363c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,2 +1,2 @@ -xvfbwrapper>=0.2.9 +PyVirtualDisplay>=3.0 pytest>=7.1.2 diff --git a/tests/test_mpv.py b/tests/test_mpv.py index 5f1f979..74999ad 100755 --- a/tests/test_mpv.py +++ b/tests/test_mpv.py @@ -31,11 +31,11 @@ import mpv if os.name == 'nt': - Xvfb = mock.Mock() + Display = mock.Mock() testvo='gpu' else: - from xvfbwrapper import Xvfb + from pyvirtualdisplay import Display testvo='x11' @@ -54,7 +54,7 @@ def timed_print(): class MpvTestCase(unittest.TestCase): def setUp(self): - self.disp = Xvfb() + self.disp = Display() self.disp.start() self.m = mpv.MPV(vo=testvo, loglevel='debug', log_handler=timed_print()) @@ -444,7 +444,7 @@ class TestStreams(unittest.TestCase): def test_python_stream(self): handler = mock.Mock() - disp = Xvfb() + disp = Display() disp.start() m = mpv.MPV(vo=testvo) def cb(evt): @@ -502,7 +502,7 @@ class TestStreams(unittest.TestCase): stream_mock.seek = mock.Mock(return_value=0) stream_mock.read = mock.Mock(return_value=b'') - disp = Xvfb() + disp = Display() disp.start() m = mpv.MPV(vo=testvo, video=False) def cb(evt): @@ -536,7 +536,7 @@ class TestStreams(unittest.TestCase): disp.stop() def test_stream_open_exception(self): - disp = Xvfb() + disp = Display() disp.start() m = mpv.MPV(vo=testvo, video=False) @@ -572,7 +572,7 @@ class TestStreams(unittest.TestCase): disp.stop() def test_python_stream_exception(self): - disp = Xvfb() + disp = Display() disp.start() m = mpv.MPV(vo=testvo) @@ -610,7 +610,7 @@ class TestStreams(unittest.TestCase): disp.stop() def test_stream_open_forward(self): - disp = Xvfb() + disp = Display() disp.start() m = mpv.MPV(vo=testvo, video=False) @@ -692,7 +692,7 @@ class TestLifecycle(unittest.TestCase): handler.assert_not_called() def test_wait_for_property_negative(self): - self.disp = Xvfb() + self.disp = Display() self.disp.start() m = mpv.MPV(vo=testvo) m.play(TESTVID) @@ -715,7 +715,7 @@ class TestLifecycle(unittest.TestCase): assert result.result() def test_wait_for_property_positive(self): - self.disp = Xvfb() + self.disp = Display() self.disp.start() handler = mock.Mock() m = mpv.MPV(vo=testvo) @@ -735,7 +735,7 @@ class TestLifecycle(unittest.TestCase): self.disp.stop() def test_wait_for_event(self): - self.disp = Xvfb() + self.disp = Display() self.disp.start() m = mpv.MPV(vo=testvo) m.play(TESTVID) @@ -757,7 +757,7 @@ class TestLifecycle(unittest.TestCase): assert result.result() def test_wait_for_property_shutdown(self): - self.disp = Xvfb() + self.disp = Display() self.disp.start() m = mpv.MPV(vo=testvo) m.play(TESTVID) @@ -771,7 +771,7 @@ class TestLifecycle(unittest.TestCase): @unittest.skipIf('test_wait_for_property_event_overflow' in SKIP_TESTS, reason="kills X-Server first") def test_wait_for_property_event_overflow(self): - self.disp = Xvfb() + self.disp = Display() self.disp.start() m = mpv.MPV(vo=testvo) m.play(TESTVID) @@ -792,7 +792,7 @@ class TestLifecycle(unittest.TestCase): self.disp.stop() def test_wait_for_event_shutdown(self): - self.disp = Xvfb() + self.disp = Display() self.disp.start() m = mpv.MPV(vo=testvo) m.play(TESTVID) @@ -802,7 +802,7 @@ class TestLifecycle(unittest.TestCase): self.disp.stop() def test_wait_for_shutdown(self): - self.disp = Xvfb() + self.disp = Display() self.disp.start() m = mpv.MPV(vo=testvo) m.play(TESTVID) @@ -814,7 +814,7 @@ class TestLifecycle(unittest.TestCase): def test_log_handler(self): handler = mock.Mock() - self.disp = Xvfb() + self.disp = Display() self.disp.start() m = mpv.MPV(vo=testvo, log_handler=handler) m.play(TESTVID) -- cgit