shutil.copytree(ctsys_resolve(os.path.join("unittest/plotweather",self.msNoWeatherfile)), self.msNoWeatherfile)
from __future__ import absolute_import
from casatasks.private.casa_transition import is_CASA6
from casatasks import plotweather
from casatools import ctsys
ctsys_resolve = ctsys.resolve
from __main__ import default
def ctsys_resolve(apath):
dataPath = os.path.join(os.environ['CASAPATH'].split()[0],'casatestdata/')
return os.path.join(dataPath,apath)
Unit tests for task plotweather. It tests the following parameters:
vis: wrong and correct values
seasonal_weight: default (0.5) and other values
doPlot: default (True) and False
plotName: if output is created; test formats
return value: [opacity] (type='list')
class plotweather_test(unittest.TestCase):
msfile = 'nep2-shrunk.ms'
msNoWeatherfile = 'ngc5921_ut.ms'
fig = '/tmp/plotweathertest.png'
defaultFig = msfile + ".plotweather.png"
if (os.path.exists(self.msfile)):
shutil.rmtree(self.msfile)
shutil.copytree(ctsys_resolve(os.path.join("unittest/plotweather",self.msfile)), self.msfile)
if (os.path.exists(self.msfile)):
shutil.rmtree(self.msfile)
if (os.path.exists(self.fig)):
if (os.path.exists(self.defaultFig)):
os.remove(self.defaultFig)
'''Test 0: Default parameters'''
with self.assertRaises(AssertionError):
with self.assertRaises(RuntimeError):