Changeset e4335ae in sasview for src/sas/qtgui/Utilities/UnitTesting/SasviewLoggerTest.py
- Timestamp:
- Jul 19, 2018 6:12:03 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- c0de493
- Parents:
- 02e7d3a
- git-author:
- Torin Cooper-Bennun <40573959+tcbennun@…> (07/19/18 06:12:03)
- git-committer:
- Piotr Rozyczko <piotr.rozyczko@…> (07/19/18 06:12:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Utilities/UnitTesting/SasviewLoggerTest.py
r53c771e re4335ae 11 11 12 12 # Local 13 from sas.qtgui.Utilities.SasviewLogger import XStream14 13 from sas.qtgui.Utilities.SasviewLogger import QtHandler 15 14 … … 23 22 """ 24 23 self.logger = logging.getLogger(__name__) 25 handler = QtHandler()26 handler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))27 self.logger.addHandler( handler)24 self.handler = QtHandler() 25 self.handler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) 26 self.logger.addHandler(self.handler) 28 27 self.logger.setLevel(logging.DEBUG) 29 28 … … 35 34 Test redirection of all levels of logging 36 35 """ 37 # Attach the listeners 38 XStream.stderr().messageWritten.connect( self.outHandlerGui.insertPlainText ) 39 XStream.stdout().messageWritten.connect( self.outHandlerGui.insertPlainText ) 36 # Attach the listener 37 self.handler.messageWritten.connect(self.outHandlerGui.insertPlainText) 40 38 41 39 # Send the signals … … 44 42 self.logger.warning('warning message') 45 43 self.logger.error('error message') 46 sys.stdout.write('with stdout')47 sys.stderr.write('with stderr')48 44 49 45 out=self.outHandlerGui.toPlainText() … … 54 50 self.assertIn('WARNING: warning message', out) 55 51 self.assertIn('ERROR: error message', out) 56 self.assertIn('with stdout', out)57 self.assertIn('with stderr', out)58 52 59 53 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.