forked from ponty/PyVirtualDisplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_core.py
58 lines (40 loc) · 1.23 KB
/
test_core.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from nose.tools import ok_
from pyvirtualdisplay.display import Display
from pyvirtualdisplay.xephyr import XephyrDisplay
from pyvirtualdisplay.xvfb import XvfbDisplay
from pyvirtualdisplay.xvnc import XvncDisplay
import sys
from unittest import TestCase
class Test(TestCase):
def test_virt(self):
vd = Display().start().stop()
# self.assertEquals(vd.return_code, 0)
ok_(not vd.is_alive())
def test_nest(self):
vd = Display().start()
ok_(vd.is_alive())
nd = Display(visible=1).start().stop()
# self.assertEquals(nd.return_code, 0)
vd.stop()
ok_(not vd.is_alive())
def test_disp(self):
vd = Display().start()
ok_(vd.is_alive())
d = Display(visible=1).start().sleep(2).stop()
# self.assertEquals(d.return_code, 0)
d = Display(visible=0).start().stop()
# self.assertEquals(d.return_code, 0)
vd.stop()
ok_(not vd.is_alive())
def test_repr():
display = Display()
print(repr(display))
def test_repr2():
display = XvfbDisplay()
print(repr(display))
def test_repr3():
display = XvncDisplay()
print(repr(display))
def test_repr4():
display = XephyrDisplay()
print(repr(display))