Commits

Kazuhiko Shimada authored ffa4b025f49
CAS-13520: modified a logic of copying testdata

casatasks/tests/tasks/test_imbaseline.py

Modified
102 102 """Copy files for testing into current path."""
103 103 _base = ctsys_resolve(basename)
104 104 src = os.path.join(_base, filename)
105 105 dst = os.path.join(os.getcwd(), filename)
106 106
107 107 if os.path.exists(dst):
108 108 if os.path.isfile(dst) or os.path.islink(dst):
109 109 os.unlink(dst)
110 110 elif os.path.isdir(dst):
111 111 shutil.rmtree(dst)
112 - self.__copytree(src, dst)
113 112
114 - def __copytree(self, src, dst):
115 113 if os.path.isfile(src):
116 114 shutil.copy(src, dst)
117 115 elif os.path.isdir(src):
118 - shutil.copytree(src, dst)
119 - elif os.path.islink(src):
120 - self.__copytree(os.readlink(src), dst)
116 + shutil.copytree(src, dst, symlinks=False)
121 117
122 118 def _create_image(self, datapath, val=1, shape=[0, 0, 0, 0]):
123 119 _ia = image()
124 120 ary = _ia.makearray(v=val, shape=shape)
125 121 _ia.fromarray(outfile=datapath, pixels=ary, overwrite=True)
126 122 _ia.done()
127 123
128 124 def _check_ms_tables(self, path):
129 125 self.assertTrue(os.path.exists(path))
130 126 for table_name in ('', 'ANTENNA', 'DATA_DESCRIPTION', 'FEED', 'FIELD', 'FLAG_CMD', 'HISTORY', 'OBSERVATION',

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

Add shortcut