Changeset 200ce9c in sasview for src/sas/qtgui/Utilities/UnitTesting


Ignore:
Timestamp:
Jul 20, 2018 3:54:02 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
6548a01
Parents:
a2b74bb (diff), e4335ae (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ESS_GUI' of https://github.com/SasView/sasview into ESS_GUI

File:
1 edited

Legend:

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

    r53c771e re4335ae  
    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.