Ignore:
Timestamp:
Jul 8, 2016 10:13:41 AM (8 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
a95260d
Parents:
e540cd2
Message:

output console + logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/UnitTesting/GuiManagerTest.py

    re540cd2 r0cd8612  
    4848        self.assertIsInstance(self.manager.filesWidget, DataExplorerWindow) 
    4949        self.assertIsInstance(self.manager.dockedFilesWidget, QDockWidget) 
     50        self.assertIsInstance(self.manager.dockedFilesWidget.widget(), DataExplorerWindow) 
    5051        self.assertEqual(self.manager.dockedFilesWidget.features(), QDockWidget.NoDockWidgetFeatures) 
    5152        self.assertEqual(self.manager._workspace.dockWidgetArea(self.manager.dockedFilesWidget), Qt.LeftDockWidgetArea) 
     53 
     54        self.assertIsInstance(self.manager.logDockWidget, QDockWidget) 
     55        self.assertIsInstance(self.manager.logDockWidget.widget(), QTextBrowser) 
     56        self.assertEqual(self.manager._workspace.dockWidgetArea(self.manager.logDockWidget), Qt.BottomDockWidgetArea) 
     57 
    5258        self.assertIsInstance(self.manager.ackWidget, Acknowledgements) 
    5359        self.assertIsInstance(self.manager.aboutWidget, AboutBox) 
    5460        self.assertIsInstance(self.manager.welcomePanel, WelcomePanel) 
     61 
     62    def testLogging(self): 
     63        """ 
     64        Test logging of stdout, stderr and log messages 
     65        """ 
     66        # See if the log window is empty 
     67        self.assertEqual(self.manager.logDockWidget.widget().toPlainText(), "") 
     68 
     69        # Now, send some message to stdout. 
     70        # We are in the MainWindow scope, so simple 'print' will work 
     71        message = "from stdout" 
     72        print message 
     73        self.assertIn(message, self.manager.logDockWidget.widget().toPlainText()) 
     74 
     75        # Send some message to stderr 
     76        message = "from stderr" 
     77        sys.stderr.write(message) 
     78        self.assertIn(message, self.manager.logDockWidget.widget().toPlainText()) 
     79 
     80        # And finally, send a log message 
     81        import logging 
     82        message = "from logging" 
     83        message_logged = "ERROR: " + message 
     84        logging.error(message) 
     85        self.assertIn(message_logged, self.manager.logDockWidget.widget().toPlainText()) 
    5586 
    5687    def testUpdatePerspective(self): 
Note: See TracChangeset for help on using the changeset viewer.