Changeset 1309205b in sasview
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Utilities/UnitTesting/SasviewLoggerTest.py
r53c771e r1309205b 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.