I am running a unit test and I realize that there is an exception getting thrown. However, I am just not sure what exactly is getting thrown.
from pt_hil.utilities.PT_HIL_Interface_Utils.widgets import PathPicker
import unittest
import wx
class TestUM(unittest.TestCase):
@classmethod
def setUpClass(cls):
print 'setUpClass called'
cls.path_picker = PathPicker()
print 'path_picker has been declared'
def test_PathPicker(self):
self.assertRaises(NotImplementedError, wx.UIActionSimulator.MouseClick(self.path_picker.browse))
if __name__ == '__main__':
unittest.main()
the PathPicker class:
class PathPicker(Widget):
def __init__(self, parent=None, name="PathPicker"):
print 'hi1'
try:
Widget.__init__(self, name, parent)
except Exception as e:
print 'hello'
return logging.error(traceback.format_exc())
print 'hi2'
the output I get when I run the unit test is:
setUpClass called
hi1
Process finished with exit code 1
So clearly, something is going wrong at: Widget.__init__(self, name, parent) but I can't see what it is. Is there any way I can get this to print out what exception or error is getting thrown?
edit: here is the Widget class to go along with it:
class Widget(QWidget):
def __init__(self, name, parent=None):
print 'hey2'
try:
super(Widget, self).__init__()
except BaseException as e:
print 'hello'
return logging.error(traceback.format_exc())
print 'hey3'
now it is giving me:
setUpClass called
hi1
hey2
Process finished with exit code 1