Source
self.assertTrue(tbreadlock==False and tbwritelock==False and lock[0]==False and lock[1]==False,
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import shutil
import unittest
from casatasks.private.casa_transition import is_CASA6
if is_CASA6:
from casatools import ctsys, image, table
from casatasks import clearstat
_ia = image( )
_tb = table( )
else:
from __main__ import default
from tasks import *
from taskinit import *
_ia = iatool( )
_tb = tb
'''
Unit tests of task clearstat. It tests the following parameters:
clears read lock on table,
clears write lock on table,
clears read lock on image,
clears write lock on image,
clears all locks
'''
# find the data in the standard place unless TEST_DATADIR is set
# for some tests, the standard place should always be used
# CASA5 and CASA6 approach this differently
# this is the relative path where most of the test data is found
datapath = 'unittest/clearstat/'
# Pick up alternative data directory to run tests on MMSs
testmms = False
if 'TEST_DATADIR' in os.environ:
testmms = True
DATADIR = os.path.join(str(os.environ.get('TEST_DATADIR')),'clearstat')
if os.path.isdir(DATADIR):
datapath = DATADIR
print('clearstat tests will use data from %s' % datapath)
# CASA5 and CASA6 differences to handle this
if is_CASA6:
def ctsys_resolve(apath,ignore_testmms=False):
# ignore_testmms isn't necessary here given how datapath is used in the tests
return ctsys.resolve(apath)
else:
def ctsys_resolve(apath,ignore_testmms=False):
result = apath
if not testmms or ignore_testmms:
# find it in the standard place
dataRoot = os.path.join(os.environ['CASAPATH'].split()[0],'casatestdata')
result = os.path.join(dataRoot,apath)
# otherwise apath should already be the full path
return result
class clearstat_test(unittest.TestCase):
# Input names
msfile = 'Itziar.ms'