Changeset 99ea1b0 in sasview for src/sas/qtgui/MainWindow


Ignore:
Timestamp:
Oct 27, 2017 8:49:35 AM (7 years ago)
Author:
Piotr Rozyczko <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:
0849aec
Parents:
895e7359
Message:

Update for unit tests and minor functionality quirks

Location:
src/sas/qtgui/MainWindow
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/MainWindow/DataExplorer.py

    • Property mode changed from 100755 to 100644
    rb0b09b9 r99ea1b0  
    175175        load_thread = threads.deferToThread(self.readData, url) 
    176176        load_thread.addCallback(self.loadComplete) 
     177        load_thread.addErrback(self.loadFailed) 
    177178 
    178179    def loadFile(self, event=None): 
     
    221222            load_thread = threads.deferToThread(self.readProject, filename) 
    222223            load_thread.addCallback(self.readProjectComplete) 
     224            load_thread.addErrback(self.readProjectFailed) 
     225 
     226    def readProjectFailed(self, reason): 
     227        """ 
     228        """ 
     229        print("readProjectFailed FAILED: ", reason) 
     230        pass 
    223231 
    224232    def readProject(self, filename): 
     
    614622            return 
    615623 
    616         #if isinstance(paths, QtCore.QStringList): 
    617         #    paths = [str(f) for f in paths] 
    618  
    619624        if not isinstance(paths, list): 
    620625            paths = [paths] 
     
    992997        self.manager.add_data(data_list=output_data) 
    993998 
     999    def loadErrback(self, reason): 
     1000        print("File Load Failed with:\n", reason) 
     1001        pass 
     1002 
    9941003    def updateModel(self, data, p_file): 
    9951004        """ 
  • src/sas/qtgui/MainWindow/UnitTesting/AboutBoxTest.py

    r464cd07 r99ea1b0  
    66from PyQt4.QtTest import QTest 
    77from PyQt4 import QtCore 
    8 from mock import MagicMock 
     8from unittest.mock import MagicMock 
    99 
    1010# set up import paths 
  • src/sas/qtgui/MainWindow/UnitTesting/DataExplorerTest.py

    • Property mode changed from 100644 to 100755
    r88e1f57 r99ea1b0  
    55from PyQt4.QtTest import QTest 
    66from PyQt4.QtCore import * 
    7 from mock import MagicMock 
    8 from mock import patch 
     7from unittest.mock import MagicMock 
     8from unittest.mock import patch 
    99from mpl_toolkits.mplot3d import Axes3D 
    1010 
     
    157157 
    158158        expected_list = [0, 0, 33, 66, -1] 
    159         spied_list = [spy_progress_bar_update.called()[i]['args'][0] for i in xrange(5)] 
     159        spied_list = [spy_progress_bar_update.called()[i]['args'][0] for i in range(5)] 
    160160        self.assertEqual(expected_list, spied_list) 
    161161         
     
    173173        filename = ["cyl_400_20.txt", "cyl_400_20.txt", "P123_D2O_10_percent.dat"] 
    174174        self.form.readData(filename) 
    175  
    176         self.form.show() 
    177         app.exec_() 
    178175 
    179176        # Assure the model contains three items 
     
    329326        self.form.cbSelect.setCurrentIndex(1) 
    330327 
     328        self.form.show() 
     329        app.exec_() 
     330 
    331331        # Test the current selection 
    332332        item1D = self.form.model.item(0) 
     
    507507        # We don't know the data ID, so need to iterate over dict 
    508508        data_dict = spy_data_received.called()[0]['args'][0] 
    509         for data_key, data_value in data_dict.iteritems(): 
     509        for data_key, data_value in data_dict.items(): 
    510510            self.assertIsInstance(data_value, Data1D) 
    511511 
  • src/sas/qtgui/MainWindow/UnitTesting/GuiManagerTest.py

    • Property mode changed from 100644 to 100755
    r8222f171 r99ea1b0  
    99from PyQt4.QtCore import * 
    1010from PyQt4.QtWebKit import * 
    11 from mock import MagicMock 
     11from unittest.mock import MagicMock 
    1212 
    1313# set up import paths 
     
    7474        # We are in the MainWindow scope, so simple 'print' will work 
    7575        message = "from stdout" 
    76         print message 
     76        print(message) 
    7777        self.assertIn(message, self.manager.logDockWidget.widget().toPlainText()) 
    7878 
     
    162162        """ 
    163163        # 1. version = 0.0.0 
    164         version_info = {u'version' : u'0.0.0'} 
     164        version_info = {'version' : '0.0.0'} 
    165165        spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 
    166166 
     
    172172 
    173173        # 2. version < LocalConfig.__version__ 
    174         version_info = {u'version' : u'0.0.1'} 
     174        version_info = {'version' : '0.0.1'} 
    175175        spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 
    176176 
     
    182182 
    183183        # 3. version > LocalConfig.__version__ 
    184         version_info = {u'version' : u'999.0.0'} 
     184        version_info = {'version' : '999.0.0'} 
    185185        spy_status_update = QtSignalSpy(self.manager, self.manager.communicate.statusBarUpdateSignal) 
    186186        webbrowser.open = MagicMock() 
  • src/sas/qtgui/MainWindow/UnitTesting/MainWindowTest.py

    r464cd07 r99ea1b0  
    55from PyQt4 import QtTest 
    66from PyQt4 import QtCore 
    7 from mock import MagicMock 
     7from unittest.mock import MagicMock 
    88 
    99# set up import paths 
Note: See TracChangeset for help on using the changeset viewer.