1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
import os
from tutil import prog_check
from pyvirtualdisplay import Display, xauth
if prog_check(["xauth", "-V"]):
def test_xauth_is_installed():
assert xauth.is_installed()
def test_xauth():
"""
Test that a Xauthority file is created.
"""
old_xauth = os.getenv("XAUTHORITY")
display = Display(visible=False, use_xauth=True)
display.start()
new_xauth = os.getenv("XAUTHORITY")
assert new_xauth is not None
assert os.path.isfile(new_xauth)
filename = os.path.basename(new_xauth)
assert filename.startswith("PyVirtualDisplay.")
assert filename.endswith("Xauthority")
display.stop()
assert old_xauth == os.getenv("XAUTHORITY")
assert not os.path.isfile(new_xauth)
|