Changeset 1309205b in sasview for src


Ignore:
Timestamp:
Jul 19, 2018 6:01:34 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Parents:
46ca1f4
Message:

modify logger unit test to reflect changes (passes)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Utilities/UnitTesting/SasviewLoggerTest.py

    r53c771e r1309205b  
    1111 
    1212# Local 
    13 from sas.qtgui.Utilities.SasviewLogger import XStream 
    1413from sas.qtgui.Utilities.SasviewLogger import QtHandler 
    1514 
     
    2322        """ 
    2423        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) 
    2827        self.logger.setLevel(logging.DEBUG) 
    2928 
     
    3534        Test redirection of all levels of logging 
    3635        """ 
    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) 
    4038 
    4139        # Send the signals 
     
    4442        self.logger.warning('warning message') 
    4543        self.logger.error('error message') 
    46         sys.stdout.write('with stdout') 
    47         sys.stderr.write('with stderr') 
    4844 
    4945        out=self.outHandlerGui.toPlainText() 
     
    5450        self.assertIn('WARNING: warning message', out) 
    5551        self.assertIn('ERROR: error message', out) 
    56         self.assertIn('with stdout', out) 
    57         self.assertIn('with stderr', out) 
    5852 
    5953if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.