You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.1 KiB

  1. import wx
  2. import time
  3. import unittest
  4. from gooey.gui.lang.i18n import _
  5. from tests.integration.programs import \
  6. all_widgets_subparser as all_widgets_subparser_module
  7. class TestGooeyIntegration11(unittest.TestCase):
  8. def test_gooeySubparserMode(self):
  9. """ Tests the happy path through the subparser run mode of Gooey """
  10. from gooey.tests.integration import runner
  11. runner.run_integration(all_widgets_subparser_module, self.gooeySanityTest)
  12. def gooeySanityTest(self, app, buildSpec):
  13. try:
  14. # Check out header is present and showing data
  15. title = app.TopWindow.header._header.GetLabel()
  16. subtitle = app.TopWindow.header._subheader.GetLabel()
  17. self.assertEqual(title, buildSpec['program_name'])
  18. self.assertEqual(subtitle, buildSpec['program_description'])
  19. # switch to the run screen
  20. app.TopWindow.onStart()
  21. # Should find the expected test in the header
  22. title = app.TopWindow.header._header.GetLabel()
  23. subtitle = app.TopWindow.header._subheader.GetLabel()
  24. self.assertEqual(title,_("running_title"))
  25. self.assertEqual(subtitle, _('running_msg'))
  26. # Wait for Gooey to swap the header to the final screen
  27. while app.TopWindow.header._header.GetLabel() == _("running_title"):
  28. time.sleep(.1)
  29. # verify that we've landed on the success screen
  30. title = app.TopWindow.header._header.GetLabel()
  31. subtitle = app.TopWindow.header._subheader.GetLabel()
  32. self.assertEqual(title, _("finished_title"))
  33. self.assertEqual(subtitle, _('finished_msg'))
  34. # and that output was actually written to the console
  35. self.assertIn("Success", app.TopWindow.console.textbox.GetValue())
  36. time.sleep(1)
  37. except:
  38. wx.CallAfter(app.TopWindow.Destroy)
  39. raise
  40. else:
  41. wx.CallAfter(app.TopWindow.Destroy)
  42. return None
  43. if __name__ == '__main__':
  44. unittest.main()