Changeset 497e06d in sasview


Ignore:
Timestamp:
Oct 19, 2017 10:52:39 AM (7 years ago)
Author:
krzywon
Branches:
unittest-saveload
Children:
add6365
Parents:
8225f33
Message:

Remove GUI necessity and add method to remove temp files when finished.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/projectsaveandload/test/utest_project.py

    r8225f33 r497e06d  
    66import sys 
    77import unittest 
    8 import logging 
    98import warnings 
    109if sys.version_info[0] >= 3: 
     
    1312    from StringIO import StringIO 
    1413 
    15 from sas.sasview.sasview import SasView 
    1614from sas.sascalc.dataloader.loader import Loader 
    17 from sas.sascalc.fit.pagestate import PageState 
    18 from sas.sasgui.perspectives.fitting.fitpage import FitPage 
     15from sas.sascalc.fit.pagestate import Reader as fit_state_reader 
     16from sas.sasgui.perspectives.invariant.invariant_state import Reader as invariant_reader 
     17from sas.sasgui.perspectives.pr.inversion_state import Reader as pr_reader 
     18from sas.sasgui.perspectives.corfunc.corfunc_state import Reader as corfunc_reader 
    1919 
    20 logger = logging.getLogger(__name__) 
    2120warnings.simplefilter("ignore") 
    2221 
    2322TEMP_FOLDER = "temp_folder" 
     23STATE_LOADERS = [fit_state_reader, invariant_reader, pr_reader, corfunc_reader] 
    2424 
    2525 
     
    3030        Set up the base unit test class and variables used throughout the tests 
    3131        """ 
     32        self.addCleanup(self.remove_dir) 
    3233        self.loader = Loader() 
    3334        self.data1d = self.loader.load("test_data/data1D.h5") 
     
    3536        if not (os.path.isdir(TEMP_FOLDER)): 
    3637            os.makedirs(TEMP_FOLDER) 
    37         self.gui = SasView() 
    3838 
    39     def addCleanUp(self): 
    40         """ 
    41         Close any open files, close any open GUI elements, and remove temp files 
    42         """ 
     39    def remove_dir(self): 
    4340        if(os.path.isdir(TEMP_FOLDER)): 
    4441            os.removedirs(TEMP_FOLDER) 
    45         self.gui.gui.Close() 
    4642 
    4743    def test_saveload_data1d_fitting_only(self): 
     
    4945        Test saving and loading a project with a single data set sent to fitting 
    5046        """ 
    51         #fitpage.fill_data_combobox([self.data1d]) 
    52         #fitpage.categorybox.SetSelection(4) 
    53         #fitpage.formfactorbox.SetSelection(6) 
     47        self.assertTrue(1 == 1) 
    5448 
    5549        # TODO: Send 1D to fitting, select model, save project, load project 
Note: See TracChangeset for help on using the changeset viewer.