Add empty classes when QtGui's not available
Also, for tests using the UsesQApplication will raise an NoQtGuiError when QtGui is not available.
This commit is contained in:
parent
62bea2811a
commit
d345245c9d
1 changed files with 13 additions and 0 deletions
|
|
@ -19,6 +19,10 @@ def adjust_filename(filename, orig_mod_filename):
|
||||||
dirpath = os.path.dirname(os.path.abspath(orig_mod_filename))
|
dirpath = os.path.dirname(os.path.abspath(orig_mod_filename))
|
||||||
return os.path.join(dirpath, filename)
|
return os.path.join(dirpath, filename)
|
||||||
|
|
||||||
|
class NoQtGuiError(Exception):
|
||||||
|
def __init__(self):
|
||||||
|
Exception.__init__(self, 'No QtGui found')
|
||||||
|
|
||||||
class BasicPySlotCase(object):
|
class BasicPySlotCase(object):
|
||||||
'''Base class that tests python slots and signal emissions.
|
'''Base class that tests python slots and signal emissions.
|
||||||
|
|
||||||
|
|
@ -71,6 +75,7 @@ if has_gui:
|
||||||
del self.app
|
del self.app
|
||||||
super(UsesQApplication, self).tearDown()
|
super(UsesQApplication, self).tearDown()
|
||||||
|
|
||||||
|
|
||||||
class TimedQApplication(unittest.TestCase):
|
class TimedQApplication(unittest.TestCase):
|
||||||
'''Helper class with timed QApplication exec loop'''
|
'''Helper class with timed QApplication exec loop'''
|
||||||
|
|
||||||
|
|
@ -88,6 +93,14 @@ if has_gui:
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
'''Delete resources'''
|
'''Delete resources'''
|
||||||
del self.app
|
del self.app
|
||||||
|
else:
|
||||||
|
class UsesQApplication(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
raise NoQtGuiError()
|
||||||
|
class TimedQapplication(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
raise NoQtGuiError()
|
||||||
|
|
||||||
|
|
||||||
_core_instance = None
|
_core_instance = None
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue