Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ponty committed Feb 15, 2016
1 parent 6aaf2fe commit f12b2e0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 21 deletions.
27 changes: 27 additions & 0 deletions tests/screenshot2.py
@@ -0,0 +1,27 @@
'''
two calls
This can be error
'''
import logging
logging.basicConfig(level=logging.DEBUG)

from easyprocess import EasyProcess
from pyvirtualdisplay.smartdisplay import SmartDisplay

backend1 = 'wx'
backend2 = 'wx'


with SmartDisplay(visible=0, bgcolor='black') as disp:
disp.pyscreenshot_backend = backend1
with EasyProcess('xmessage test1'):
img1 = disp.waitgrab()

with SmartDisplay(visible=0, bgcolor='black') as disp:
disp.pyscreenshot_backend = backend2
with EasyProcess('xmessage test2'):
img2 = disp.waitgrab()

img1.show()
img2.show()
8 changes: 4 additions & 4 deletions tests/test_smart.py
@@ -1,6 +1,6 @@
from easyprocess import EasyProcess
from nose.tools import eq_
from path import path
from path import Path
from pyvirtualdisplay.smartdisplay import SmartDisplay, DisplayTimeoutError
from unittest import TestCase
import sys
Expand All @@ -20,7 +20,7 @@ def test_disp(self):

def test_slowshot(self):
disp = SmartDisplay(visible=0).start()
py = path(__file__).parent / ('slowgui.py')
py = Path(__file__).parent / ('slowgui.py')
proc = EasyProcess('python ' + py).start()
img = disp.waitgrab()
proc.stop()
Expand All @@ -29,7 +29,7 @@ def test_slowshot(self):

def test_slowshot_wrap(self):
disp = SmartDisplay(visible=0)
py = path(__file__).parent / ('slowgui.py')
py = Path(__file__).parent / ('slowgui.py')
proc = EasyProcess('python ' + py)
f = disp.wrap(proc.wrap(disp.waitgrab))
img = f()
Expand All @@ -43,7 +43,7 @@ def test_empty(self):

def test_slowshot_timeout(self):
disp = SmartDisplay(visible=0)
py = path(__file__).parent / ('slowgui.py')
py = Path(__file__).parent / ('slowgui.py')
proc = EasyProcess('python ' + py)
f = disp.wrap(proc.wrap(lambda: disp.waitgrab(timeout=1)))
self.assertRaises(DisplayTimeoutError, f)
37 changes: 20 additions & 17 deletions tests/test_smart2.py
@@ -1,9 +1,9 @@
from easyprocess import EasyProcess
from nose.tools import eq_
from pyvirtualdisplay.smartdisplay import SmartDisplay, DisplayTimeoutError
from pyvirtualdisplay.smartdisplay import SmartDisplay
from unittest import TestCase
from path import path
import pyscreenshot
# from path import path
# import pyscreenshot


class Test(TestCase):
Expand All @@ -25,26 +25,29 @@ def check_double(self, backend1, backend2=None):
img = disp.waitgrab()
eq_(img is not None, True)

def test_double_wx(self):
self.check_double('wx')
# def test_double_wx(self):
# self.check_double('wx')

def test_double_pygtk(self):
self.check_double('pygtk')
# def test_double_pygtk(self):
# self.check_double('pygtk')

def test_double_pyqt(self):
self.check_double('pyqt')
# def test_double_pyqt(self):
# self.check_double('pyqt')

def test_double_imagemagick(self):
self.check_double('imagemagick')
# def test_double_imagemagick(self):
# self.check_double('imagemagick')

def test_double_scrot(self):
self.check_double('scrot')

def test_double_wx_pygtk(self):
self.check_double('wx', 'pygtk')
# def test_double_imagemagick_scrot(self):
# self.check_double('imagemagick', 'scrot')

def test_double_wx_pyqt(self):
self.check_double('wx', 'pyqt')
# def test_double_wx_pygtk(self):
# self.check_double('wx', 'pygtk')

def test_double_pygtk_pyqt(self):
self.check_double('pygtk', 'pyqt')
# def test_double_wx_pyqt(self):
# self.check_double('wx', 'pyqt')

# def test_double_pygtk_pyqt(self):
# self.check_double('pygtk', 'pyqt')

0 comments on commit f12b2e0

Please sign in to comment.