summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-04-30 17:02:29 +0200
committerjaseg <136313+jaseg@users.noreply.github.com>2023-06-03 18:31:21 +0200
commit3036f64b68207d74a06efcfbc2fdac91a6a70bbc (patch)
tree2b672f80f768e6522e7eff84328c823ce600c2cc
parent5a1a2734f2238cd201b4c94d878eb9daf31c3b63 (diff)
downloadpython-mpv-3036f64b68207d74a06efcfbc2fdac91a6a70bbc.tar.gz
python-mpv-3036f64b68207d74a06efcfbc2fdac91a6a70bbc.tar.bz2
python-mpv-3036f64b68207d74a06efcfbc2fdac91a6a70bbc.zip
Replace xvfbwrapper with PyVirtualDisplay
Fixes #249
-rw-r--r--pyproject.toml2
-rw-r--r--tests/requirements.txt2
-rwxr-xr-xtests/test_mpv.py32
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)