Changeset 425feff in sasview


Ignore:
Timestamp:
Feb 15, 2018 10:28:55 AM (7 years ago)
Author:
krzywon
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
2924532
Parents:
3ee0451
Message:

Move the deprecation check so it is always called, regardless of file loading success.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    rc36c09f r425feff  
    9494                    if not self.f_open.closed: 
    9595                        self.f_open.close() 
     96                    if any(filepath.lower().endswith(ext) for ext in 
     97                           self.deprecated_extensions): 
     98                        self.handle_error_message(DEPRECATION_MESSAGE) 
    9699                    if len(self.output) > 0: 
    97                         if any(filepath.lower().endswith(ext) for ext in 
    98                                self.deprecated_extensions): 
    99                             self.handle_error_message(DEPRECATION_MESSAGE) 
    100100                        # Sort the data that's been loaded 
    101101                        self.sort_one_d_data() 
     
    156156        else: 
    157157            logger.warning(msg) 
     158            raise NoKnownLoaderException(msg) 
    158159 
    159160    def send_to_output(self): 
  • test/sasdataloader/test/utest_generic_file_reader_class.py

    r3ee0451 r425feff  
    1010from sas.sascalc.dataloader.data_info import DataInfo, plottable_1D 
    1111from sas.sascalc.dataloader.loader import Loader 
     12from sas.sascalc.dataloader.loader_exceptions import NoKnownLoaderException 
    1213from sas.sascalc.dataloader.file_reader_base_class import FileReader 
    1314 
     
    2930 
    3031    def test_bad_file_path(self): 
    31         output = self.reader.read(self.bad_file) 
    32         self.assertEqual(output, []) 
     32        self.assertRaises(NoKnownLoaderException, self.reader.read, 
     33                          self.bad_file) 
    3334 
    3435    def test_good_file_path(self): 
Note: See TracChangeset for help on using the changeset viewer.