Source
########################################################################
# test_task_sdgaincal.py
#
# Copyright (C) 2018
# Associated Universities, Inc. Washington DC, USA
#
# This script is free software; you can redistribute it and/or modify it
# under the terms of the GNU Library General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
# License for more details.
#
# [Add the link to the JIRA ticket here once it exists]
#
# Based on the requirements listed in plone found here:
# https://casadocs.readthedocs.io/en/stable/api/tt/casatasks.single.sdgaincal.html
#
#
##########################################################################
import os
import shutil
import unittest
import numpy
from casatasks import mstransform, sdcal, sdgaincal
from casatasks.private.sdutil import table_manager
from casatools import ctsys
from casatools import ms as mstool
from casatools import table as tbtool
# this distinction doesn't exist in casatasks
mstransform_cli = mstransform
sdcal_cli = sdcal
class sdgaincal_test_base(unittest.TestCase):
"""
Base class for sdgainal unit tests.
This class defines attributes and methods common to test cases
"""
datapath = ctsys.resolve('unittest/sdgaincal/')
def __copy_from_datapath(self, filename):
if os.path.exists(filename):
shutil.rmtree(filename)
shutil.copytree(os.path.join(self.datapath, filename), filename)
def setUp(self):
self.__copy_from_datapath(self.infile)
if hasattr(self, 'reffile'):
self.__copy_from_datapath(self.reffile)
def tearDown(self):
to_be_removed = [self.infile, self.outfile]
if hasattr(self, 'reffile'):