sillyemperor: > I was a new guy of Python,when i want to test my wxPython app by > unittest,it couldn`t work.I fund a stubmaker.py but it only for > wxDialog but all widgets.Can someone can tell me how test wxPython by > unittest?Thanks >
Here's a small example to get you started: import unittest, wx class TextCtrlTest(unittest.TestCase): def setUp(self): app = wx.App(0) frame = wx.Frame(None) self.textCtrl = wx.TextCtrl(frame) def testInitialContents(self): self.assertEqual('', self.textCtrl.GetValue()) def testAppendText(self): self.textCtrl.AppendText('whatever') self.assertEqual('whatever', self.textCtrl.GetValue()) def testAppendTextTwice(self): self.textCtrl.AppendText('whatever') self.textCtrl.AppendText('and then some') self.assertEqual('whateverand then some', self.textCtrl.GetValue()) if __name__ == '__main__': unittest.main() Cheers, Frank -- http://mail.python.org/mailman/listinfo/python-list