Commits

Akeem Wells authored 25e6a0d134c
Replace use of testhelper and other helper files in tests to use casatestutils

casa5/gcwrap/python/scripts/casatestutils/testhelper.py

Modified
698 698 if isinstance(tol,float):
699 699 tol=tol+np.zeros(len(keys))
700 700 mss=[ms0,ms1]
701 701 s=[]
702 702 for i in range(2):
703 703 if not os.access(mss[i],F_OK):
704 704 print(mss[i]+" not found")
705 705 return False
706 706 ms_local.open(mss[1])
707 707 stats = ms_local.statistics("DATA",ap)
708 - s.append(stats[stats.keys()[0]])
708 + s.append(stats[list(stats)[0]])
709 709 ms_local.done()
710 710 status=True
711 711 for ik in range(len(keys)):
712 712 k=keys[ik]
713 713 s0=s[0][k]
714 714 s1=s[1][k]
715 715 if abs(s0-s1)*2/(s0+s1)>tol[ik]: status=False
716 716 if verbose:
717 717 print(("%7s: "%k),s0,s1)
718 718 return status
728 728 if not os.path.exists(name):
729 729 shutil.copytree(os.path.join(datadir, name), outname,
730 730 ignore=ignore_subversion)
731 731
732 732
733 733 def get_table_cache():
734 734 cache = tb_local.showcache()
735 735 # print('cache = {}'.format(cache))
736 736 return cache
737 737
738 +def is_casa6():
739 + try:
740 + # CASA 6
741 + from casatools import table
742 + return True
743 + except ImportError:
744 + try:
745 + # CASA 5
746 + from taskinit import tbtool
747 + return False
748 + except ImportError:
749 + raise Exception('Neither CASA5 nor CASA6')
738 750
739 751 class TableCacheValidator(object):
740 752 def __init__(self):
741 753 self.original_cache = get_table_cache()
742 754
743 755 def validate(self):
744 756 cache = get_table_cache()
745 757 #print 'original {} current {}'.format(self.original_cache, cache)
746 758 return len(cache) == 0 or cache == self.original_cache
747 759

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut