Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_repr_xephyr():
display = Display(visible=True)
print(repr(display))
display = Display(backend="xephyr")
print(repr(display))
display = XephyrDisplay()
print(repr(display))
# assert not d._is_started
# d.start()
# assert d._is_started
# d.stop()
# assert d._is_started
# with Display() as d:
# assert d._is_started
# assert d._is_started
with XvfbDisplay() as d:
assert d._is_started
assert d._is_started
with Display():
with XephyrDisplay() as d:
assert d._is_started
assert d._is_started
def test_extra_args():
# Unrecognized option
d = Display(extra_args=["willcrash"])
with pytest.raises(XStartError):
d.start()
with Display():
# -c turns off key-click
with Display(visible=True, extra_args=["-c"]) as d:
assert d.is_alive()
assert not d.is_alive()
with XephyrDisplay(extra_args=["-c"]) as d:
assert d.is_alive()
assert not d.is_alive()
from pyvirtualdisplay.xephyr import XephyrDisplay
from pyvirtualdisplay.xvfb import XvfbDisplay
from pyvirtualdisplay.xvnc import XvncDisplay
_class_map = {"xvfb": XvfbDisplay, "xvnc": XvncDisplay, "xephyr": XephyrDisplay}
class Display(object):
"""
Proxy class
:param color_depth: [8, 16, 24, 32]
:param size: screen size (width,height)
:param bgcolor: background color ['black' or 'white']
:param visible: True -> Xephyr, False -> Xvfb
:param backend: 'xvfb', 'xvnc' or 'xephyr', ignores ``visible``
:param xauth: If a Xauthority file should be created.
"""
def __init__(
self,