casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
test_pcasa.py
Go to the documentation of this file.
00001 import unittest
00002 import pCASA
00003 from tasks import *
00004 
00005 class pcasa_test(unittest.TestCase):
00006 
00007     def shortDescription(self):
00008         return "Test of pCASA parallel task wrapper"
00009 
00010     def setUp(self):
00011         print "Importing data..."
00012         self.vis = ["ngc5921-1.ms",
00013                     "ngc5921-2.ms",
00014                     "ngc5921-3.ms",
00015                     "ngc5921-4.ms",
00016                     "ngc5921-5.ms",
00017                     "ngc5921-6.ms"]
00018         if True:
00019             importuvfits(os.environ.get('CASAPATH').split()[0] + \
00020                          '/data/regression/ngc5921/ngc5921.fits', \
00021                          self.vis[0])
00022         else:
00023             assert os.system("cp -r " +
00024                              os.environ.get('CASAPATH').split()[0] + \
00025                              "/data/regression/wproject_regression/coma.ms " + \
00026                              self.vis[0]) == 0
00027 
00028         for i in range(1, 6):
00029             assert os.system("cp -r " + self.vis[0] + " " + self.vis[i]) == 0
00030 
00031     def tearDown(self):
00032         for v in self.vis:
00033             os.system("rm -rf " + v)
00034             os.system("rm -rf " + v + ".flagversions")
00035 
00036     def test1(self):
00037         vis = "multi.ms"
00038 
00039         pCASA.create(vis)
00040         for i in range(6):
00041             pCASA.add(vis, self.vis[i], "localhost")
00042         
00043         pCASA.list(vis)
00044 
00045         print "Remove a few subMSs"
00046         pCASA.remove(vis, self.vis[0])
00047         pCASA.remove(vis, self.vis[3])
00048         pCASA.remove(vis, self.vis[4])
00049 
00050         pCASA.list(vis)
00051 
00052         listobs(vis)
00053 
00054         print "Re-add what was removed, on default=localhost"
00055         pCASA.add(vis, self.vis[0])
00056         pCASA.add(vis, self.vis[3])
00057         pCASA.add(vis, self.vis[4])
00058 
00059         pCASA.list(vis)
00060 
00061         listobs(vis)
00062 
00063         flagdata(vis,
00064                   scan = "3",
00065                   antenna = "8",
00066                   mode='unflag',
00067                   flagbackup = False)
00068         
00069 
00070 
00071         flagcmd(vis, inpmode="list")
00072 
00073         # Commented out because of CAS-2661.
00074         #for log in pCASA.pc.cluster.get_casalogs():
00075         #    assert os.system("cat " + log) == 0
00076 
00077 def suite():
00078     return [pcasa_test]