forked from ponty/PyVirtualDisplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_xauth.py
31 lines (24 loc) · 794 Bytes
/
test_xauth.py
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
30
31
import os
import easyprocess
from nose import SkipTest
from nose.tools import ok_, eq_
from pyvirtualdisplay import xauth
from pyvirtualdisplay.display import Display
def test_xauth():
'''
Test that a Xauthority file is created.
'''
if not xauth.is_installed():
raise SkipTest('This test needs xauth installed')
old_xauth = os.getenv('XAUTHORITY')
display = Display(visible=0, use_xauth=True)
display.start()
new_xauth = os.getenv('XAUTHORITY')
ok_(new_xauth is not None)
ok_(os.path.isfile(new_xauth))
filename = os.path.basename(new_xauth)
ok_(filename.startswith('PyVirtualDisplay.'))
ok_(filename.endswith('Xauthority'))
display.stop()
eq_(old_xauth, os.getenv('XAUTHORITY'))
ok_(not os.path.isfile(new_xauth))