Changeset 84545dd in sasview for DataLoader/test


Ignore:
Timestamp:
Sep 3, 2008 4:33:48 PM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
Branches:
master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
c87d55a
Parents:
d831626
Message:

Added module importing from zip files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/test/testplugings.py

    rdaa56d0 r84545dd  
    3434        self.assertTrue(self.L.loaders.has_key('.test')) 
    3535         
     36class testZip(unittest.TestCase): 
     37     
     38    def setUp(self): 
     39        self.L=Registry() 
     40         
     41        # Create module 
     42        import zipfile 
     43        z = zipfile.PyZipFile("plugins.zip", 'w') 
     44        z.writepy("../plugins", "") 
     45        z.close() 
     46         
     47    def testplugin_checksetup(self): 
     48        """  
     49            Check that the test is valid by confirming 
     50            that the file can't be loaded without the 
     51            plugins 
     52        """ 
     53        self.assertRaises(ValueError, self.L.load, 'test_data.test') 
     54         
     55    def testplugin(self): 
     56        """  
     57            test loading with a test reader only  
     58            found in the plugins directory 
     59        """ 
     60        self.L.find_plugins('.') 
     61        output = self.L.load('test_data.test') 
     62        self.assertEqual(output.x[0], 1234.) 
     63        self.assertTrue(self.L.loaders.has_key('.test')) 
     64         
     65         
    3666if __name__ == '__main__': 
    3767    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.